bench.tcl: fix the pi benchmark
[jimtcl.git] / examples / parray.tcl
blob8ac5d3da241516087e2a6ac73b44ad678d89f68b
1 # Example of using the 'putter' function to redirect parray output
3 set a {1 one 2 two 3 three}
5 # Use 'curry' to create a single command from two words
6 stderr puts "curry"
7 parray a * [curry stderr puts]
9 # Same thing, but an alias instead
10 stderr puts "\nalias"
11 alias stderr_puts stderr puts
12 parray a * stderr_puts
14 # Now use a lambda to accumulate the results in a buffer
15 stderr puts "\nlamba"
16 parray a * [lambda {msg} {lappend ::lines $msg}]
17 stderr puts [join $lines \n]