
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? Janek

Is 'y' even referred to in `f`? I don't think it is, so it doesn't make
sense to say if it's bound or free.
My $.01 (half-off because I don't know what I'm talking about)
John L.
On Wed, Sep 17, 2014 at 11:49 PM, Jan Stolarek
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?
Janek _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

On Thu, Sep 18, 2014 at 2:09 PM, John Lato
Is 'y' even referred to in `f`? I don't think it is, so it doesn't make sense to say if it's bound or free.
My $.01 (half-off because I don't know what I'm talking about)
Here, I'll add another penny for payment in full. :) I think you do know what you're talking about and I don't see a reference to 'y' in 'f' either, modulo the ... that has already been pointed out. -- Kim-Ee

I think bound and free usually refers to *occurrences* of variables in an expression. In your example you only have occurrences of g and c, but there may be more hiding in the ... part. A variable is free in an expression if the path from the root to the variable does not include a binder for the variable. In your example, g is bound in the whole expression, but free in the sub-expression g c. However, I think that "bound" is also sometimes used to mean "in scope", and this seems to be mainlyyour interpretation. When you say "y is bound in g", you really mean that y is in scope in *the body* of g (i.e. in the ...) / Emil Den 2014-09-18 08:49, Jan Stolarek skrev:
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?
Janek _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[The previous message went off prematurely.] I think bound and free usually refers to *occurrences* of variables in an expression. In your example you only have occurrences of g and c, but there may be more hiding in the ... part. A variable is free in an expression if the path from the root to the variable does not include a binder for the variable. In your example, g is bound in the whole expression, but free in the sub-expression g c. However, I think that "bound" is also sometimes used to mean "in scope", and this seems to be mainly your interpretation. When you say "y is bound in g", you really mean that y is in scope in *the body* of g (i.e. in the ...), or, alternatively that every occurrence of y in the body of g is bound. (IIUC...) / Emil Den 2014-09-18 08:49, Jan Stolarek skrev:
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?
Janek _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Thanks Emil.
I think bound and free usually refers to *occurrences* of variables in an expression. Right. I think I was a bit confused here.
However, I think that "bound" is also sometimes used to mean "in scope", and this seems to be mainly your interpretation. Yup, I think that was it.
Thanks for clearing this up for me. Janek

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.
participants (5)
-
Emil Axelsson
-
Jan Stolarek
-
John Lato
-
Kim-Ee Yeoh
-
Michael Orlitzky