Is there a difference between Schema closure and normal closure in other languages?

I am currently studying SICP. And I found that the definition of closure in SICP is (possibly) different from the definition of closure in other languages.

Here's what SICP says:

The ability to create pairs whose elements are pairs is the essence of the importance of list structure as a presentation tool. We call this the closure property cons. In general, an operation of combining data objects satisfies the closure property if the results of combining things with that operation can themselves be combined using the same operation.

Here, closure is closer to closure in mathematics, I think, and not what I saw in JavaScript, which means the ability of a function to access private environment variables.

I made a mistake?

+5


source to share


2 answers


You're right; this text does not refer to "closure" - an implementation strategy that ensures the correct correspondence of value functions to lexical relationships - but more generally to the mathematical concept of "closure", for example, in the statement "integers" are closed by an add operation. " : Applying the operation to any two items in the set results in a result that is still a member of the set.



+6


source


There is a difference in the use of "closure" in SICP versus the way it is commonly used in calculations. From SICP chapter 2 footnote 6:

The use of the word "closure" here comes from abstract algebra, where a set of elements is said to be closed with respect to an if operation, applying an operation to elements in a set creates an element that is again an element of the set. The Lisp community also (unfortunately) uses the word "closure" to describe a completely unrelated concept: closure is an implementation method for representing procedures with free variables. We do not use the word "closure" in this second sense in this book.



On the other hand, Schemer uses "closures" to refer to lexical closures , just like programmers using other languages ​​with lexical closures.

+6


source







All Articles