Runtime evaluation/In an environment: Difference between revisions
Content added Content deleted
(→{{header|Octave}}: changed into an imitation of python, more or less) |
(→{{header|Tcl}}: (before: bad understanding of the tcl code? note the apply) maybe the error was elsewhere; now hopefully fixed) |
||
Line 179: | Line 179: | ||
=={{header|Tcl}}== |
=={{header|Tcl}}== |
||
{{incorrect|Tcl|The code provided should not itself be a function, but have x as a free variable.}} |
|||
<lang tcl>package require Tcl 8.5 |
<lang tcl>package require Tcl 8.5 |
||
proc |
proc evalit {func a} { |
||
set |
set r [apply $func $a] |
||
expr {$r} |
|||
⚫ | |||
} |
} |
||
set a [evalit {x {expr {2 ** $x}}} 3]; |
|||
set b [evalit {x {expr {2 ** $x}}} 5]; |
|||
⚫ | |||
</lang> |