Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
10
Task/Anonymous-recursion/Tcl/anonymous-recursion-1.tcl
Normal file
10
Task/Anonymous-recursion/Tcl/anonymous-recursion-1.tcl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
proc fib n {
|
||||
# sanity checks
|
||||
if {[incr n 0] < 0} {error "argument may not be negative"}
|
||||
apply {x {
|
||||
if {$x < 2} {return $x}
|
||||
# Extract the lambda term from the stack introspector for brevity
|
||||
set f [lindex [info level 0] 1]
|
||||
expr {[apply $f [incr x -1]] + [apply $f [incr x -1]]}
|
||||
}} $n
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue