33from mathics .builtin .base import Builtin , BoxConstruct
44from mathics .core .expression import Atom , Expression , Symbol , String , from_python , Integer , Real
55from mathics .core .evaluation import Evaluation
6-
6+ from types import FunctionType
7+
78class Compile (Builtin ):
89 '''
910 <dl>
@@ -142,6 +143,8 @@ def __init__(self, cfunc, args, **kwargs):
142143 self .args = args
143144
144145 def __str__ (self ):
146+ if type (self .cfunc ) is FunctionType :
147+ return '-PythonizedCode-'
145148 return '-CompiledCode-'
146149
147150 def do_copy (self ):
@@ -166,21 +169,21 @@ def __hash__(self):
166169 return hash (("CompiledCode" , ctypes .addressof (self .cfunc ))) # XXX hack
167170
168171 def atom_to_boxes (self , f , evaluation ):
169- return Expression ('CompiledCodeBox' )
172+ return Expression ('CompiledCodeBox' , self )
170173
171174
172175class CompiledCodeBox (BoxConstruct ):
173176 """
174177 Used internally by <i>CompileCode[]</i>.
175178 """
176179 def boxes_to_text (self , leaves , ** options ):
177- return '-CompiledCode-'
180+ return leaves [ 0 ]. __str__ ()
178181
179182 def boxes_to_xml (self , leaves , ** options ):
180- return '-CompiledCode-'
183+ return leaves [ 0 ]. __str__ ()
181184
182185 def boxes_to_tex (self , leaves , ** options ):
183- return '-CompiledCode-'
186+ return leaves [ 0 ]. __str__ ()
184187
185188
186189class CompiledFunction (Builtin ):
0 commit comments