I've been banging my head at this question for sometime and I can't figure it out. I've read the definition of free variable "Free variables and bound variables" from wikipedia and several books but I can't get the answer right
Consider the following code:
local A B C=1 D=2 in
A = 1
proc {Add E F G}
E = A + D + F
end
end
Which of these identifiers (A, B, C, D, E, F, G) are free identifiers?
The concept of free identifier comes always with a context. If you consider only the statement E=A+D+F
the four identifiers are free. But if you consider the procedure definition, E and F are now bound because they are formal parameters. So the free identifiers are A and D. Finally if you consider the entire code you give, there is no free identifier since all identifiers are declared.
Reference : Concepts, Techniques and Models of Computer Programming by Peter Van Roy and Seif Haridi.
The end of page 57 and the page 58 are interesting for this matter.
The first three chapters are available on the edX platform if you enroll the course Paradigms of Computer Programming