Reputation: 51
The result of the following expression is 39,how the numbers 7 and 4 are mapped to a and b,because I understand that b is 7 and and a is 4 and I get 27 as a result but the result is 39
(((lambda [a] (lambda [b] (+ (* 5 a) b))) 7) 4)
Upvotes: 0
Views: 52
Reputation: 24
Here is how it reduces
(((lambda [a] (lambda [b] (+ (* 5 a) b))) 7) 4)
((lambda [b] (+ (* 5 7) b)) 4)
(+ (* 5 7) 4)
39
the first redex is ((lambda [a] ...) 7) so a is bound to 7
the second redex to be reduced is ((lambda [b] ...) 4) so b is bound to 4
Upvotes: 1