HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

Closure

Categories: Glossary

A closure, the opposite of a combinator, is a function that makes use of free variables in its definition. It 'closes' around some portion of its environment. for example

f x = (\y -> x + y)

f returns a closure, because the variable x, which is bound outside of the lambda abstraction is used inside its definition.

An interesting a side note: the context in which x was bound shouldn't even exist anymore, and wouldn't, had the lambda abstraction not closed around x.

Retrieved from "http://haskell.org/haskellwiki/Closure"

This page has been accessed 1,572 times. This page was last modified 20:27, 18 October 2006. Recent content is available under a simple permissive license.