RosettaCodeData/Task/First-class-functions/Factor/first-class-functions.factor
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07:00

10 lines
324 B
Factor

USING: assocs combinators kernel math.functions prettyprint
sequences ;
IN: rosettacode.first-class-functions
CONSTANT: A { [ sin ] [ cos ] [ 3 ^ ] }
CONSTANT: B { [ asin ] [ acos ] [ 1/3 ^ ] }
: compose-all ( seq1 seq2 -- seq ) [ compose ] 2map ;
: test1 ( -- )
0.5 A B compose-all
[ call( x -- y ) ] with map . ;