Search code examples
lambdaschemelisplambda-calculussicp

Lambda calculus to scheme


Is the following the correct way to "map" how a lambda function looks to how it would be written in scheme?

(λx.x+1) 5(lambda (x) (+ x 1) 5)

Additionally, how are lambda functions 'named' in the formal notation? Is there something that corresponds to this:

Add One = (λx.x+1)


Solution

  • (λx.x+1)5 is an application to the argument 5. In Scheme code this would be equivalent to:

    ((lambda (x) (+ x 1)) 5)
    

    Here the (lambda (x) (+ x 1)) constitutes the function, and it must be placed in a function call context by wrapping it in parentheses with its arguments.

    As far as naming in formal notation is concerned, this is not a feature of the lambda calculus proper. In texts it is often found that some sort of identifier notation is used to facilitate the expression of combinations; it seems like very simple identifiers are usually preferred in these cases. This is really mathematical notation, not programming notation. I have seen both of these:

    A ≡ λx.x+1
    A = λx.x+1