all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
3
Task/Y-combinator/PicoLisp/y-combinator-1.l
Normal file
3
Task/Y-combinator/PicoLisp/y-combinator-1.l
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(de Y (F)
|
||||
(let X (curry (F) (Y) (F (curry (Y) @ (pass (Y Y)))))
|
||||
(X X) ) )
|
||||
9
Task/Y-combinator/PicoLisp/y-combinator-2.l
Normal file
9
Task/Y-combinator/PicoLisp/y-combinator-2.l
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Factorial
|
||||
(de fact (F)
|
||||
(curry (F) (N)
|
||||
(if (=0 N)
|
||||
1
|
||||
(* N (F (dec N))) ) ) )
|
||||
|
||||
: ((Y fact) 6)
|
||||
-> 720
|
||||
9
Task/Y-combinator/PicoLisp/y-combinator-3.l
Normal file
9
Task/Y-combinator/PicoLisp/y-combinator-3.l
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# Fibonacci
|
||||
(de fibo (F)
|
||||
(curry (F) (N)
|
||||
(if (> 2 N)
|
||||
1
|
||||
(+ (F (dec N)) (F (- N 2))) ) ) )
|
||||
|
||||
: ((Y fibo) 22)
|
||||
-> 28657
|
||||
10
Task/Y-combinator/PicoLisp/y-combinator-4.l
Normal file
10
Task/Y-combinator/PicoLisp/y-combinator-4.l
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Ackermann
|
||||
(de ack (F)
|
||||
(curry (F) (X Y)
|
||||
(cond
|
||||
((=0 X) (inc Y))
|
||||
((=0 Y) (F (dec X) 1))
|
||||
(T (F (dec X) (F X (dec Y)))) ) ) )
|
||||
|
||||
: ((Y ack) 3 4)
|
||||
-> 125
|
||||
Loading…
Add table
Add a link
Reference in a new issue