12 lines
508 B
Plaintext
12 lines
508 B
Plaintext
{ {extern "manool.org.18/std/0.3/all"} in
|
|
: let { Y = {proc {F} as {proc {X} as X[X]}[{proc {F; X} as F[{proc {X; Y} as X[X][Y]}.Bind[X]]}.Bind[F]]} } in
|
|
{ for { N = Range[10] } do
|
|
: (WriteLine) Out; N "! = "
|
|
{Y: proc {Rec} as {proc {Rec; N} as: if N == 0 then 1 else N * Rec[N - 1]}.Bind[Rec]}$[N]
|
|
}
|
|
{ for { N = Range[10] } do
|
|
: (WriteLine) Out; "Fib " N " = "
|
|
{Y: proc {Rec} as {proc {Rec; N} as: if N == 0 then 0 else: if N == 1 then 1 else Rec[N - 2] + Rec[N - 1]}.Bind[Rec]}$[N]
|
|
}
|
|
}
|