handouts/Advanced/Lambda Calculus/parts/01 combinators.tex
2023-10-18 09:16:29 -07:00

42 lines
1.1 KiB
TeX
Executable File

\section{Combinators}
\definition{}
A \textit{free variable} in a $\lm$-expression is a variable that isn't bound to any input. \par
For example, $b$ is a free variable in $(\lm a.a)~b$.
\definition{Combinators}
A \textit{combinator} is a lambda expression with no free variables.
\vspace{1mm}
Notable combinators are often named after birds.\hspace{-0.5ex}\footnotemark{} We've already met a few: \par
The \textit{Idiot}, $I = \lm a.a$ \par
The \textit{Mockingbird}, $M = \lm f.ff$ \par
The \textit{Cardinal}, $C = \lm fgx.(~ f(g(x)) ~)$
The \textit{Kestrel}, $K = \lm ab . a$
\problem{}
If we give the Kestrel two arguments, it does something interesting: \par
It selects the first and rejects the second. \par
Convince yourself of this fact by evaluating $(K~\heartsuit~\star)$.
\vfill
\problem{}<kitedef>
Modify the Kestrel so that it selects its \textbf{second} argument and rejects the first. \par
\begin{solution}
$\lm ab . b$.
\end{solution}
\vfill
\problem{}
We'll call the combinator from \ref{kitedef} the \textit{Kite}, $KI$. \par
Show that we can also obtain the kite by evaluating $(K~I)$.
\vfill
\pagebreak