diff --git a/higher-order.roc b/higher-order.roc index d87c5b6..75f39d7 100644 --- a/higher-order.roc +++ b/higher-order.roc @@ -6,10 +6,17 @@ app "higher-order" main : Task.Task {} I32 main = fn1 = bind Num.sub 3 - fn2 = bindL Num.sub 3 - fn3 = compose fn2 fn1 + fn2 = bindL Num.mul 3 + fn3 = compose fn1 fn2 + fn4 = compose fn2 fn1 + fn5 = compose (compose fn1 fn2) (compose fn3 fn4) + fn6 : F64 -> Int a + fn6 = + (\n -> n) + |> compose Num.sqrt + |> compose Num.ceiling results = - [fn1 2, fn2 2, fn3 2] + [fn1 2, fn2 2, fn3 2, fn4 2, fn5 2, fn6 9] |> List.map Num.toStr |> List.mapWithIndex \e, idx -> "fn$(Num.toStr idx) -> $(e)" |> Str.joinWith "\n"