
On 09/18/2014 02:49 AM, Jan Stolarek wrote:
Hi *,
I have a simple question about terminology regarding bound and free variables. Assume I have:
let f x = let g y = ... in g c in ...
Now: - `c` is free in `g` and `f` - `y` is bound in `g` - `x` is free in `g`. - `x` is bound in `f`
What about `y` in `f`? Is it also bound in `f`? If so then it certainly is bound in a different way that `x`. Is there a terminology that allows to distinguish these different forms of bound variables?
It's hard to tell from your example, but if you want, you can translate the let binding directly to lambda calculus and then go from there where the rules are simple. In Haskell, let <name> = <argument> in <expression> translates to, (\<name> -> <expression>) <argument> The "let f x = ..." is just defining a function (\x -> ...), but it hides the body of the function at the end of all the nested lets. Once you have the entire thing written out in curried form you can find out whether or not y is bound by assigning it as homework.