Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,9 @@
|
|||
proc eval_twice {func a b} {
|
||||
set x $a
|
||||
set 1st [expr $func]
|
||||
set x $b
|
||||
set 2nd [expr $func]
|
||||
expr {$2nd - $1st}
|
||||
}
|
||||
|
||||
puts [eval_twice {2 ** $x} 3 5] ;# ==> 24
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
proc eval_with_x {code val1 val2} {
|
||||
expr {[set x $val2; eval $code] - [set x $val1; eval $code]}
|
||||
}
|
||||
eval_with_x {expr {2**$x}} 3 5 ;# ==> 24
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package require Tcl 8.5
|
||||
proc eval_with {body a b} {
|
||||
set lambda [list x $body]
|
||||
expr {[apply $lambda $b] - [apply $lambda $a]}
|
||||
}
|
||||
|
||||
eval_with {expr {2**$x}} 3 5 ;# ==> 24
|
||||
Loading…
Add table
Add a link
Reference in a new issue