From: Matthijs Kooijman Date: Wed, 27 Jan 2010 15:13:58 +0000 (+0100) Subject: Make the sumif example fit in a column. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=cdeb73b9c1117a3ad288691c40a81a7f96845fe7;p=matthijs%2Fmaster-project%2Fdsd-paper.git Make the sumif example fit in a column. --- diff --git "a/c\316\273ash.lhs" "b/c\316\273ash.lhs" index a00112f..e824b76 100644 --- "a/c\316\273ash.lhs" +++ "b/c\316\273ash.lhs" @@ -538,13 +538,14 @@ mac a b c = add (mul a b) c matching and guards. \begin{verbatim} -sumif pred a b = if pred == Eq && a == b || pred == Neq && a != b - then a + b - else 0 +sumif cmp a b = if cmp == Eq && a == b + || cmp == Neq && a != b + then a + b + else 0 \end{verbatim} \begin{verbatim} -sumif pred a b = case pred of +sumif cmp a b = case cmp of Eq -> case a == b of True -> a + b False -> 0