Lambda Calculus – Call by Value vs. Call by Name (Lazy Evaluation)

evaluationlambdalambda-calculus

Having difficulties deciding which rules to apply on by value / by name evaulation.
Say I have:

(λz.zz)(λb.b)

And I want to evaluate according to call by valute, will the next step be

(λz.z)(λb.b)

(evaluate the left side – z apply on z),
or

(λz.(λb.b)(λb.b))

(evaluate the right side first)

And how does the evluation goes for call by name?

Best Answer

You want to apply

(λz.zz)

to the argument

(λb.b)
  • Call by value means: reduce the argument to normal form and then bind the parameter z to it
  • Call by name means: replace each occurrence of the parameter z in the body of the function by the unevaluated argument

Since λb.b is already in normal form, it does not make a difference whether you use call by name or call by value: in both cases you will end up replacing each occurrence of z by λb.b, giving

(λb.b) (λb.b)