From: Christiaan Baaij Date: Wed, 27 Jan 2010 13:52:43 +0000 (+0100) Subject: Start using code instead of verbatim environments for code listings X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=d2b5f23b4cb1f6c78b43a5dbfd785b10901bb6b6;p=matthijs%2Fmaster-project%2Fdsd-paper.git Start using code instead of verbatim environments for code listings --- diff --git a/clash.fmt b/clash.fmt new file mode 100644 index 0000000..7521af2 --- /dev/null +++ b/clash.fmt @@ -0,0 +1 @@ +%format != = "\neq" \ No newline at end of file diff --git "a/c\316\273ash.lhs" "b/c\316\273ash.lhs" index 16608ab..9ec58f1 100644 --- "a/c\316\273ash.lhs" +++ "b/c\316\273ash.lhs" @@ -370,6 +370,7 @@ \usepackage{paralist} %include polycode.fmt +%include clash.fmt \begin{document} % @@ -540,27 +541,24 @@ mac a b c = add (mul a b) c expression, one using only case expressions and one using pattern matching and guards. -\begin{verbatim} -sumif pred a b = if pred == Eq && a == b || pred == Neq && a != b - then a + b - else 0 -\end{verbatim} +\begin{code} +sumif pred a b = + if pred == Eq && a == b || pred == Neq && a != b + then a + b + else 0 -\begin{verbatim} sumif pred a b = case pred of - Eq -> case a == b of - True -> a + b - False -> 0 - Neq -> case a != b of - True -> a + b - False -> 0 -\end{verbatim} - -\begin{verbatim} -sumif Eq a b | a == b = a + b -sumif Neq a b | a != b = a + b -sumif _ _ _ = 0 -\end{verbatim} + Eq -> case a == b of + True -> a + b + False -> 0 + Neq -> case a != b of + True -> a + b + False -> 0 + +sumif Eq a b | a == b = a + b +sumif Neq a b | a != b = a + b +sumif _ _ _ = 0 +\end{code} TODO: Pretty picture