Arithmetic evaluation: Difference between revisions

m
Line 1,448:
 
=={{header|Tcl}}==
{{works with|Tcl|8.5}}
The code below delivers the AST for an expression in a form that it can be immediately eval-led, using Tcl's prefix operators.
<lang Tcl>namespace import tcl::mathop::*
namespace import tcl::mathop::*
 
proc arieval str {
Line 1,494:
} \n] {
puts "$test ..... [eval $test] ..... [eval [eval $test]]"
}</lang>
}
</lang>
Output:<pre>
arieval 2-2 ..... - 2 2 ..... 0
Anonymous user