Polymorphic functions
compose : (b -> c) -> (a -> b) -> a -> c = \f. \g. \x. (f (g x))
inc : Int -> Int = \x. (add x 1)
double : Int -> Int = \x. (mul x 2)
doubleThenInc : Int -> Int = (compose inc double)
describe : Int -> String = (compose (concat "n = ") show)
(println (show (doubleThenInc 5)))
(println (describe 5))
Output
11
n = 5
Run it yourself from the repository root: lbd run tests/golden/programs/polymorphic_functions.lbd