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

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