Evaluating a Function: Bracketing Issues

56 Views Asked by At

I have the following and am asked to evaluate it (I've posted this question elsewhere but I have a new worry with evaluating the function).

$[[\lambda f.\lambda m. f(m + m^2))]([\lambda n.2n])](3)$

I'm worried about mis-evaluating this because I'm putting brackets in the wrong place.

Here's my reasoning thus far.

  1. I bind $\lambda n.2n$ to $f$ to get the following:

$[[\lambda m.[\lambda n.2n](m+m^2)](3).$

  1. Then I bind $(m+m^2)$ to $n$ to get the following:

$[\lambda m.2(m+m^2)](3)$

  1. And then finally I bound (3) to $m$ to get this:
    $2(3+3^2)$ which equals 36.

I'm worried that at (2) I should bind THREE to $m$ and gotten this instead:
$\lambda n.2n(3+3^2)$ and THIS should be my end result.

Does anyone have any thoughts, tips, suggestions or see any mistakes or anything? Help would be greatly appreciated; I'm really struggling with Lambda Calculus stuff.