Runtime evaluation: Difference between revisions

Content added Content deleted
No edit summary
(show argument passing)
Line 226: Line 226:


=={{header|J}}==
=={{header|J}}==
Use the monad ". to execute a string.
Use the monad [http://www.jsoftware.com/help/dictionary/d601.htm ".] to execute a string.



http://www.jsoftware.com/help/dictionary/d601.htm


<lang J>
<lang J>
". 'a =. +/ 1 2 3' NB. execute a string to sum 1, 2 and 3 and assign to noun a
". 'a =: +/ 1 2 3' NB. execute a string to sum 1, 2 and 3 and assign to noun a
</lang>
</lang>

Or, use the conjunction [http://www.jsoftware.com/help/dictionary/d310n.htm :] to create various kinds of functions and evaluate them. Arguments have names which as specified by the language definition. For example:

<lang J>(3 : '+/y') 1 2 3</lang>

Rules of scope for such functions match those described on the [[Scope modifiers]] page.


=={{header|Perl}}==
=={{header|Perl}}==