Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
10
Task/Factorial/Babel/factorial-1.pb
Normal file
10
Task/Factorial/Babel/factorial-1.pb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
((main
|
||||
{(0 1 2 3 4 5 6 7 8 9 10)
|
||||
{fact ! %d nl <<}
|
||||
each})
|
||||
|
||||
(fact
|
||||
{({dup 0 =}{ zap 1 }
|
||||
{dup 1 =}{ zap 1 }
|
||||
{1 }{ <- 1 {iter 1 + *} -> 1 - times })
|
||||
cond}))
|
||||
10
Task/Factorial/Babel/factorial-2.pb
Normal file
10
Task/Factorial/Babel/factorial-2.pb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
((main
|
||||
{(0 1 2 3 4 5 6 7 8 9 10)
|
||||
{fact ! %d nl <<}
|
||||
each})
|
||||
|
||||
(fact
|
||||
{({dup 0 =}{ zap 1 }
|
||||
{dup 1 =}{ zap 1 }
|
||||
{1 }{ dup 1 - fact ! *})
|
||||
cond}))
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
main:
|
||||
{ argv 0 th $d
|
||||
fac
|
||||
%d cr << }
|
||||
|
||||
fac!:
|
||||
{ dup zero?
|
||||
{ dup one?
|
||||
{ cp 1 - fac * }
|
||||
{ zap 1 }
|
||||
if }
|
||||
{ zap 1 }
|
||||
if }
|
||||
|
||||
one?! : { 1 = }
|
||||
zero?!: { 0 = }
|
||||
Loading…
Add table
Add a link
Reference in a new issue