Posted to tcl by kbk at Tue Aug 21 02:14:10 GMT 2012view raw

  1. namespace path ::tcl::mathop
  2.  
  3. proc U {x args} {tailcall apply $x $x {*}$args}
  4.  
  5. puts [U {{f n} {
  6. if {$n <= 1} {
  7. return $n
  8. } else {
  9. tailcall + [U $f [- $n 1]] [U $f [- $n 2]]
  10. }
  11. }} 10]