1
$\begingroup$

Given

mult = \x -> \y -> x*y

I am trying to reduce

(mult (1+2)) (2+3)

with each of the strategies:

  • normal-order
  • applicative-order
  • call-by-name
  • call-by-value

My attempt:

For both applicative and by-value I get the same (because no intermediate lambda expression contains anything reducible, hence applicative does not do reduction under lambda either)

(mult (1+2)) (2+3)
(mult 3) (2+3)
(\y -> 3*y) (2+3)
(\y -> 3*y) 5
3*5
15

With normal and by-name: I am supposed to substitute (2+3) into the body of (mult (1+2)). But that does not have a body, unless I do a reduction. But then it is not normal-order, nor call-by-name, since it is not the outermost I reduce. Hence it seems to me that these evaluation strategies "get stuck". But I am probably misunderstanding smth.

Please show me the correct evaluation.

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.