RosettaCodeData/Task/Function-composition/Wren/function-composition.wren
2023-07-01 13:44:08 -04:00

7 lines
187 B
Text

var compose = Fn.new { |f, g| Fn.new { |x| f.call(g.call(x)) } }
var double = Fn.new { |x| 2 * x }
var addOne = Fn.new { |x| x + 1 }
System.print(compose.call(double, addOne).call(3))