Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
10
Task/Y-combinator/Factor/y-combinator-1.factor
Normal file
10
Task/Y-combinator/Factor/y-combinator-1.factor
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
USING: fry kernel math ;
|
||||
IN: rosettacode.Y
|
||||
: Y ( quot -- quot )
|
||||
'[ [ dup call call ] curry @ ] dup call ; inline
|
||||
|
||||
: almost-fac ( quot -- quot )
|
||||
'[ dup zero? [ drop 1 ] [ dup 1 - @ * ] if ] ;
|
||||
|
||||
: almost-fib ( quot -- quot )
|
||||
'[ dup 2 >= [ 1 2 [ - @ ] bi-curry@ bi + ] when ] ;
|
||||
5
Task/Y-combinator/Factor/y-combinator-2.factor
Normal file
5
Task/Y-combinator/Factor/y-combinator-2.factor
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
USING: kernel tools.test rosettacode.Y ;
|
||||
IN: rosettacode.Y.tests
|
||||
|
||||
[ 120 ] [ 5 [ almost-fac ] Y call ] unit-test
|
||||
[ 8 ] [ 6 [ almost-fib ] Y call ] unit-test
|
||||
Loading…
Add table
Add a link
Reference in a new issue