Lambda Discipline

Examples

Church pairs

examples/pair.lbd

use "std.lbd"

p : (Int, String) = (1, "one")

(println (show p))
(println (join "" [(show (fst p)), " is ", (snd p)]))
(println (show (swap p)))
(println (show ((uncurry add) (2, 3))))
-- A lambda can take a pair apart in its parameter.
(println (show (map \(n, name). (concat name (show n)) [p, (2, "two")])))

Output

(1, "one")
1 is one
("one", 1)
5
["one1", "two2"]

Run it yourself from the repository root: lbd run examples/pair.lbd