0

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?

5

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)
1

Neither of these steps is correct, there is only one reducible expression in that term so in both cases the only valid step is to (\b. b)(\b. b). You are only allowed to perform a reduction when applying a lambda abstraction and there is only one place where you are doing that, namely on the outermost level.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.