Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Mutual-recursion/Smalltalk/mutual-recursion.st
Normal file
23
Task/Mutual-recursion/Smalltalk/mutual-recursion.st
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
|F M ra rb|
|
||||
|
||||
F := [ :n |
|
||||
(n == 0)
|
||||
ifTrue: [ 1 ]
|
||||
ifFalse: [ n - (M value: (F value: (n-1))) ]
|
||||
].
|
||||
|
||||
M := [ :n |
|
||||
(n == 0)
|
||||
ifTrue: [ 0 ]
|
||||
ifFalse: [ n - (F value: (M value: (n-1))) ]
|
||||
].
|
||||
|
||||
ra := OrderedCollection new.
|
||||
rb := OrderedCollection new.
|
||||
0 to: 19 do: [ :i |
|
||||
ra add: (F value: i).
|
||||
rb add: (M value: i)
|
||||
].
|
||||
|
||||
ra displayNl.
|
||||
rb displayNl.
|
||||
Loading…
Add table
Add a link
Reference in a new issue