Runtime evaluation: Difference between revisions
Content added Content deleted
(Provide additional information about J) |
(Added PicoLisp) |
||
Line 335: | Line 335: | ||
print eval($code); |
print eval($code); |
||
</lang> |
</lang> |
||
=={{header|PicoLisp}}== |
|||
In PicoLisp there is a formal equivalence of code and data. Almost any peace of |
|||
data is potentially executable. PicoLisp has three internal data types: Numbers, |
|||
symbols and lists. Though in certain contexts (e.g. GUI objects) also atomic |
|||
data (numbers and symbols) are evaluated as code entities, a typical executable |
|||
item is a list. |
|||
The PicoLisp reference distinguishes between two terms: An 'exe' (expression) is |
|||
an executable list, with a function as the first element, followed by arguments. |
|||
A 'prg' (program) is a list of 'exe's, to be executed sequentially. |
|||
'exe's and 'prg's are implicit in the whole runtime system. For example, the |
|||
body of a function is a 'prg', the "true" branch of an 'if' call is an 'exe', |
|||
while the "false" branch again is a 'prg'. |
|||
For explicit execution, an 'exe' can be evaluated by passing it to the function |
|||
'[http://software-lab.de/doc/refE.html#eval eval]', while a 'prg' can be handled |
|||
by '[http://software-lab.de/doc/refR.html#run run]'. |
|||
As PicoLisp uses exclusively dynamic binding, any 'exe' or 'prg' can be executed |
|||
in arbitrary contexts. The environmet can be controlled in any conceivable way, |
|||
through implicit function parameter bindings, or explicitly with the aid of |
|||
functions like '[http://software-lab.de/doc/refB.html#bind bind]', |
|||
'[http://software-lab.de/doc/refL.html#let let]' or |
|||
'[http://software-lab.de/doc/refJ.html#job job]'. |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||