Skip to main content

Lambdas

Anonymous functions, lambdas, take the form of:

(\x -> x + 1)
(\x y -> x + y)

Note the skinny RH arrow ->.

You can think of general functions of the form buildRobot arms legs torso = (arms, legs, torso) as a series of lambda functions.

Tip This is useful to recall when building functions that take functions as a parameter.

buildRobotLambda = (\arms ->
\legs ->
\torso -> (arms, legs, torso))
-- which implies:
(((buildRobot "strong arms") "skinny legs") "long torso")
-- and
buildRobotLambda "strong arms" "skinny legs" "long torso"