How do I write and apply a simple lambda function using the tcl 8.6 features "apply" and "lmap"?
map (lambda x -> x*x) [list 1 2 3]
how can I write the above in Tcl 8.6? The man pages are not that self explanatory for me.
Perhaps also a more advance version, but I guess I can figure that out myself:
lambda y -> map (lambda x -> x*x) y
Basically I would like to improve this version:
proc \x {f val} {
set res [apply $f $val]
set res
}
set res [\x {x {expr $x*$x}} 5]
puts "res: $res"
So that I can just write:
set res [\x {expr $x*$x} 5]
puts "res: $res"