Posted to tcl by kbk at Mon May 04 14:30:21 GMT 2009view raw

  1. puts [apply {{f a} {tailcall {*}$f $f 1 $a}} {apply {{f a x} {
  2. if {$x == 0} {
  3. set a
  4. } else {
  5. tailcall {*}$f $f [expr {$a * $x}] [expr {$x - 1}]
  6. }
  7. }}} 6]