[Haskell-cafe] 1 = 0?
Alexey Muranov
alexey.muranov at gmail.com
Tue Jun 17 11:14:53 UTC 2014
On Tuesday, June 17, 2014 1:08:45 PM UTC+2, Brent Yorgey wrote:
The general syntax of assignments is
>
> pattern = expression
>
> One most often uses a pattern consisting of a single variable, but any
> pattern will do. (For example, try writing [x,y,z] = [1,2,3] as a
> top-level declaration and see what happens!) 1 is a pattern which
> matches the number 1. 0 is obviously an expression. Of course, the
> pattern 1 does not match the expression 0. However, binding is lazy:
> for example, writing [x,y] = [1,2,3] does not in and of itself cause
> an error; it will only cause an error if you try to use x or y.
> However, since the pattern 1 contains no variables, there is no way to
> ever force the pattern-matching to actually take place.
>
> So 1 = 0 just sits there, sort of like an ugly, angry dog who wants to
> bite people except that it is locked in a cage with no door.
> Occasionally people walking by look at it pityingly, but mostly no one
> pays it any attention.
Thanks for the detailed explanation, i think i've understood.
Alexey.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140617/761a59f7/attachment.html>
More information about the Haskell-Cafe
mailing list