RosettaCodeData/Task/Function-composition/Lingo/function-composition-3.lingo

17 lines
486 B
Plaintext

-- compose new function based on built-in function 'sin' and user-defined function 'asin'
f1 = compose(#asin, #sin)
put call(f1, _movie, 0.5)
-- 0.5000
-- compose new function based on previously composed function 'f1' and user-defined function 'double'
f2 = compose(#double, f1)
put call(f2, _movie, 0.5)
-- 1.0000
-- compose new function based on 2 composed functions
f1 = compose(#asin, #sin)
f2 = compose(#double, #triple)
f3 = compose(f2, f1)
put call(f3, _movie, 0.5)
-- 3.0000