RosettaCodeData/Task/Higher-order-functions/Tcl/higher-order-functions-2.tcl
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

19 lines
469 B
Tcl

# This procedure executes its argument with an extra argument of "2"
proc demoFrag {fragment} {
{*}$fragment 2
}
# This procedure executes its argument in the context of its caller, which is
# useful for scripts so they get the right variable resolution context
proc demoScript {script} {
uplevel 1 $script
}
# Examples...
set chan stderr
demoFrag [list puts $chan]
demoFrag {
apply {x {puts [string repeat ? $x]}}
}
demoScript {
parray tcl_platform
}