Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
9
Task/Y-combinator/Smalltalk/y-combinator-1.st
Normal file
9
Task/Y-combinator/Smalltalk/y-combinator-1.st
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Y := [:f| [:x| x value: x] value: [:g| f value: [:x| (g value: g) value: x] ] ].
|
||||
|
||||
fib := Y value: [:f| [:i| i <= 1 ifTrue: [i] ifFalse: [(f value: i-1) + (f value: i-2)] ] ].
|
||||
|
||||
(fib value: 10) displayNl.
|
||||
|
||||
fact := Y value: [:f| [:i| i = 0 ifTrue: [1] ifFalse: [(f value: i-1) * i] ] ].
|
||||
|
||||
(fact value: 10) displayNl.
|
||||
1
Task/Y-combinator/Smalltalk/y-combinator-2.st
Normal file
1
Task/Y-combinator/Smalltalk/y-combinator-2.st
Normal file
|
|
@ -0,0 +1 @@
|
|||
Y := [:f| [:x| (f value: (Y value: f)) value: x] ].
|
||||
Loading…
Add table
Add a link
Reference in a new issue