@@ -75,7 +75,7 @@ class Environment(Builtin):
7575
7676 summary_text = "list the system environment variables"
7777
78- def apply (self , var , evaluation ):
78+ def eval (self , var , evaluation ):
7979 "Environment[var_String]"
8080 env_var = var .get_string_value ()
8181 if env_var not in os .environ :
@@ -116,7 +116,7 @@ class GetEnvironment(Builtin):
116116
117117 summary_text = "retrieve the value of a system environment variable"
118118
119- def apply (self , var , evaluation ):
119+ def eval (self , var , evaluation ):
120120 "GetEnvironment[var___]"
121121 if isinstance (var , String ):
122122 env_var = var .get_string_value ()
@@ -262,24 +262,49 @@ def evaluate(self, evaluation) -> Integer:
262262
263263class ProcessorType (Predefined ):
264264 r"""
265- <url>:WMA link:https://reference.wolfram.com/language/ref/ProcessorType.html</url>
265+ <url>
266+ :WMA link:
267+ https://reference.wolfram.com/language/ref/ProcessorType.html</url>
266268
267269 <dl>
268- <dt>'$ProcessorType'
269- <dd>gives a string giving the architecture of the processor on which the \Mathics is being run.
270+ <dt>'$ProcessorType'
271+ <dd>gives a string giving the architecture of the processor on which the \Mathics is being run.
270272 </dl>
271- X> $ProcessorType
272- = x86_64
273+
274+ >> $ProcessorType
275+ = ...
273276 """
277+ name = "$ProcessorType"
278+
274279 summary_text = (
275280 "name of the architecture of the processor over which Mathics is running"
276281 )
277- name = "$ProcessorType"
278282
279283 def evaluate (self , evaluation ):
280284 return String (platform .machine ())
281285
282286
287+ class PythonImplementation (Predefined ):
288+ r"""
289+ ## <url>:PythonImplementation native symbol:</url>
290+
291+ <dl>
292+ <dt>'$PythonImplementation'
293+ <dd>gives a string indication the Python implementation used to run \Mathics.
294+ </dl>
295+ >> $PythonImplementation
296+ = ...
297+ """
298+ name = "$PythonImplementation"
299+
300+ summary_text = "name of the Python implementation running Mathics"
301+
302+ def evaluate (self , evaluation ):
303+ from mathics .system_info import python_implementation
304+
305+ return String (python_implementation ())
306+
307+
283308class ScriptCommandLine (Predefined ):
284309 """
285310 <url>:WMA link:https://reference.wolfram.com/language/ref/ScriptCommandLine.html</url>
@@ -320,7 +345,7 @@ class Run(Builtin):
320345
321346 summary_text = "run a system command"
322347
323- def apply (self , command , evaluation ):
348+ def eval (self , command , evaluation ):
324349 "Run[command_String]"
325350 command_str = command .to_python ()
326351 return Integer (subprocess .call (command_str , shell = True ))
@@ -480,7 +505,7 @@ class MemoryAvailable(Builtin):
480505
481506 summary_text = "the available amount of physical memory in the system"
482507
483- def apply (self , evaluation ) -> Integer :
508+ def eval (self , evaluation ) -> Integer :
484509 """MemoryAvailable[]"""
485510 totalmem = psutil .virtual_memory ().available
486511 return Integer (totalmem )
@@ -523,7 +548,7 @@ class MemoryAvailable(Builtin):
523548
524549 summary_text = "the available amount of physical memory in the system"
525550
526- def apply (self , evaluation ) -> Integer :
551+ def eval (self , evaluation ) -> Integer :
527552 """MemoryAvailable[]"""
528553 return Integer (- 1 )
529554
@@ -543,7 +568,7 @@ class MemoryInUse(Builtin):
543568
544569 summary_text = "number of bytes of memory currently being used by Mathics"
545570
546- def apply_0 (self , evaluation ) -> Integer :
571+ def eval_0 (self , evaluation ) -> Integer :
547572 """MemoryInUse[]"""
548573 # Partially borrowed from https://code.activestate.com/recipes/577504/
549574 from itertools import chain
@@ -596,7 +621,7 @@ class Share(Builtin):
596621
597622 summary_text = "force Python garbage collection"
598623
599- def apply (self , evaluation ) -> Integer :
624+ def eval (self , evaluation ) -> Integer :
600625 """Share[]"""
601626 # TODO: implement a routine that swap all the definitions,
602627 # collecting repeated symbols and expressions, and then
@@ -610,7 +635,7 @@ def apply(self, evaluation) -> Integer:
610635 gc .collect ()
611636 return Integer0
612637
613- def apply_with_symbol (self , symbol , evaluation ) -> Integer :
638+ def eval_with_symbol (self , symbol , evaluation ) -> Integer :
614639 """Share[symbol_Symbol]"""
615640 # TODO: implement a routine that swap all the definitions,
616641 # collecting repeated symbols and expressions, and then
0 commit comments