[Haskell-cafe] Bloom Filter

Henning Thielemann lemming at henning-thielemann.de
Wed May 2 07:10:01 EDT 2007


On Mon, 30 Apr 2007 ajb at spamcop.net wrote:

> In bloom:
>
> Function guards are your friends!  This:
>
>     bloom hf sz hc = if condition
>                      then b
>                      else error "Badness"
>
> is almost always better expressed as:
>
>     bloom hf sz hc
>       | condition = b
>       | otherwise = error "Badness"

Why replacing the almost-function 'if' by a special syntactic construct?
Why replacing the two-branch decision 'if' by a multi-branch construct
(similar to "switch") with two-branches? Express simple things the simple
way!


More information about the Haskell-Cafe mailing list