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

9 lines
388 B
Text

? def x := 0.5 \
> for i => f in forward {
> def g := reverse[i]
> println(`x = $x, f = $f, g = $g, compose($f, $g)($x) = ${compose(f, g)(x)}`)
> }
x = 0.5, f = <sin>, g = <asin>, compose(<sin>, <asin>)(0.5) = 0.5
x = 0.5, f = <cos>, g = <acos>, compose(<cos>, <acos>)(0.5) = 0.4999999999999999
x = 0.5, f = <cube>, g = <curt>, compose(<cube>, <curt>)(0.5) = 0.5000000000000001