Difference between revisions of "Combinator"

From HaskellWiki
Jump to navigation Jump to search
m (Substitute "meanings" for "uses", which is repeated in "common usage")
m (fmt fix)
 
Line 7: Line 7:
 
A "function with no free variables" is a pure lambda-expression that refers only to its arguments, like
 
A "function with no free variables" is a pure lambda-expression that refers only to its arguments, like
   
<code>
+
<haskell>
\a -> a
+
\a -> a
\a -> \b -> a
+
\a -> \b -> a
\f -> \a -> \b -> f b a
+
\f -> \a -> \b -> f b a
</code>
+
</haskell>
   
 
and so on. The study of such things is called [[combinatory logic]]. They are certainly used in Haskell -- the examples above are <code>id</code>, <code>const</code>, and <code>flip</code> respectively. Many of the functions involved in the <code>Applicative</code> instance for <code>((->) e)</code> also fall into this category. But such examples are fairly limited.
 
and so on. The study of such things is called [[combinatory logic]]. They are certainly used in Haskell -- the examples above are <code>id</code>, <code>const</code>, and <code>flip</code> respectively. Many of the functions involved in the <code>Applicative</code> instance for <code>((->) e)</code> also fall into this category. But such examples are fairly limited.

Latest revision as of 11:09, 12 April 2021

There are two distinct meanings of the word "combinator" in common usage.

The first is a narrow, technical meaning, namely:

A function or definition with no free variables.

A "function with no free variables" is a pure lambda-expression that refers only to its arguments, like

\a -> a
\a -> \b -> a
\f -> \a -> \b -> f b a

and so on. The study of such things is called combinatory logic. They are certainly used in Haskell -- the examples above are id, const, and flip respectively. Many of the functions involved in the Applicative instance for ((->) e) also fall into this category. But such examples are fairly limited.

The second meaning of "combinator" is a more informal sense referring to the combinator pattern, a style of organizing libraries centered around the idea of combining things. This is the meaning of "combinator" which is more frequently encountered in the Haskell community. Usually there is some type T, some functions for constructing "primitive" values of type T, and some "combinators" which can combine values of type T in various ways to build up more complex values of type T.


Question: On which syllable do you put the stress when saying "combinator"?

I say COM-bin-ay-tur, since it comes from "combine". -- User:AndrewBromage

See also: