## Lecture 4 - F1LAE bind function name in let

Jannis
Mausschubser
Beiträge: 63
Registriert: 15. Apr 2015 17:10

### Lecture 4 - F1LAE bind function name in let

Hello!

On slide 9 of the fourth lecture, we say that a function Id could be bound to names in let expressions in the F1WAE/F1LAE language. How is this possible? The only way to reference the name of a function is Id(functionName).

For the F1LAE with substitution: Because function definitions are not declared inside the program and we do eager substitution, the interpreter would stop at the case

Code: Alles auswählen

case Id(name) => sys.error("found unbound id " + name)
For the F1LAE with environments: This seems to be the same. We try to find the definition of the function in the environment

Code: Alles auswählen

case Id(name) => env(name)
which obviously fails because functions are defined separately from the variables.

Is there a different way to bind functions to names in this language?

mirko-koehler
Mausschubser
Beiträge: 82
Registriert: 16. Okt 2017 12:28

### Re: Lecture 4 - F1LAE bind function name in let

The slide says
Function applications can be bound to names in let expressions.
A function application is specified by the App expression. That means you can specify, e.g., Let y := f(2) in y + 1. You can not bind function definitions to other names.

Jannis
Mausschubser
Beiträge: 63
Registriert: 15. Apr 2015 17:10

### Re: Lecture 4 - F1LAE bind function name in let

But directly underneath the sentence you quoted, the slide also says
Function Id can be bound to names in let expressions.

mirko-koehler
Mausschubser
Beiträge: 82
Registriert: 16. Okt 2017 12:28

### Re: Lecture 4 - F1LAE bind function name in let

That means that you can use function ids as names in let expressions, i.e. you can use the name but it will not refer to the function. There is no error when a name defined in a let expression is equal to a function id.