RosettaCodeData/Task/First-class-functions/Factor/first-class-functions.factor

12 lines
329 B
Factor
Raw Permalink Normal View History

2013-06-05 21:47:54 +00:00
USING: assocs combinators kernel math.functions prettyprint sequences ;
2013-04-10 21:29:02 -07:00
IN: rosettacode.first-class-functions
CONSTANT: A { [ sin ] [ cos ] [ 3 ^ ] }
CONSTANT: B { [ asin ] [ acos ] [ 1/3 ^ ] }
2013-06-05 21:47:54 +00:00
2013-04-10 21:29:02 -07:00
: compose-all ( seq1 seq2 -- seq ) [ compose ] 2map ;
2013-06-05 21:47:54 +00:00
: test-fcf ( -- )
2013-04-10 21:29:02 -07:00
0.5 A B compose-all
[ call( x -- y ) ] with map . ;