All pastes #905230 Raw Edit

Unnamed

public text v1 · immutable
·published 2008-02-15 17:24 UTC
rendered paste body
fn id {ret $0}
fn dbl {ret [+ $0 $0]}
fn do {body while cond} {
   eval $body 1
   while $cond {eval $body 1}
}

call [fn {ret [+ $0 $0]}] 1
# reason for two syntaxes: when passing {...block...} to fn
# and it wants to pass args
# it can do this by doing: fn $var 1 (1 is like in eval, tcl's uplevel)
call [fn {{x y} ret [+ $x $y]}] 1 2
call [fn {x y} {ret [+ $x $y]}] 1 2