X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fmaster-project%2Fdsd-paper.git;a=blobdiff_plain;f=c%CE%BBash.lhs;h=438cce4290f1004a5f12713d2dcb243f7f5602d3;hp=7673139de694e58f66ac4a3218053e62d4755931;hb=5f94742c1854c1d5f47d4e89f8d96bc74d1b20c9;hpb=cd09f87baad1da1101776a0f68d7290af056eaf0 diff --git "a/c\316\273ash.lhs" "b/c\316\273ash.lhs" index 7673139..438cce4 100644 --- "a/c\316\273ash.lhs" +++ "b/c\316\273ash.lhs" @@ -606,10 +606,7 @@ by an (optimizing) \VHDL\ synthesis tool. % against the constructors in the \hs{case} expressions. We can see two versions of a contrived example below, the first using a \hs{case} construct and the other using a \hs{if-then-else} - constructs, in the code below. The example sums two values when they are - equal or non-equal (depending on the predicate given) and returns 0 - otherwise. Both versions of the example roughly correspond to the same - netlist, which is depicted in \Cref{img:choice}. + constructs, in the code below. \begin{code} sumif pred a b = case pred of @@ -634,6 +631,11 @@ by an (optimizing) \VHDL\ synthesis tool. \caption{Choice - sumif} \label{img:choice} \end{figure} + + The example sums two values when they are equal or non-equal (depending on + the predicate given) and returns 0 otherwise. Both versions of the example + roughly correspond to the same netlist, which is depicted in + \Cref{img:choice}. A slightly more complex (but very powerful) form of choice is pattern matching. A function can be defined in multiple clauses, where each clause