-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchapter02-haskell-ramp-up.tex
30 lines (23 loc) · 1.61 KB
/
chapter02-haskell-ramp-up.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
%!TEX root = fp.tex
% Author: Philipp Moers <soziflip funny character gmail dot com>
\chapter{Haskell Ramp-Up} % (fold)
\label{cha:haskell_ramp_up}
(Read $\equiv$ as ``denotes the same value as'')
\begin{itemize}
\item Apply f to value e: \codeline{f e} (juxtaposition, ``apply'', binary operator \textvisiblespace, Haskell speak: infixL 10 \textvisiblespace)
\item \textvisiblespace\ has max precedence (10): \codeline{f e$_1$ + e$_2$} $\equiv$ \codeline{(f e$_1$) + e$_2$}
\item \textvisiblespace\ associates to the left: \codeline{g f e} $\equiv$ \codeline{(g f) e} \\ (\codeline{(g f)} is a function) \item Function composition: \begin{itemize}
\item \codeline{( g . f ) e} $\equiv$ \codeline{g (f e)} \\ (. is something like mathematical $\circ$ ``after'')
\item Alternative ``apply''-operator \codeline{\$} (lowest precedence, associates to the right, infixR 0 \$):\\
\codeline{g \$ f \$ e} $\equiv$ \codeline{g \$ (f \$ e)} $\equiv$ \codeline{g (f e)}
\item Prefix application of binary infix operator $\otimes$: \codeline{$(\otimes)$ e$_1$ e$_2$} $\equiv$ \codeline{e$_1$ $\otimes$ e$_2$}
\item Infix application of binary function f: \codeline{e$_1$ `f` e$_2$} $\equiv$ \codeline{f e$_1$ e$_2$}:
\begin{itemize}
\item \codeline{1 `elem` [1,2,3]} ($1 \in \{1,2,3\}$)
\item \codeline{n `mod` m}
\item \dots
\end{itemize}
\item User defined operators, built from symbols \\ ! \# \$ \% \& * + / < = > ? \@ \textbackslash \string^ \textbar $\sim$:.
\end{itemize}
\end{itemize}
% chapter haskell_ramp_up (end)