[Haskell-cafe] Bound and free variables

Emil Axelsson emax at chalmers.se
Thu Sep 18 07:22:53 UTC 2014


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 at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list