Posted to tcl by oldlaptop at Fri Dec 19 00:52:45 GMT 2025view raw
- set fib {{n} {
- if {$n == 0} {
- return 0
- } elseif {$n == 1} {
- return 1
- } else {
- set self [dict get [info frame 0] lambda]
- ::tcl::mathop::+ \
- [apply $self [expr {$n - 1}]] \
- [apply $self [expr {$n - 2}]]
- }
- }}
- apply $fib 8
Add a comment