[Haskell-cafe] An interesting curiosity
sam lee
skynare at gmail.com
Thu Sep 18 23:20:27 EDT 2008
I think it's because + is left associative. and pattern matching is
top to bottom.
1 + 1 + 1 => (1 + 1) + 1 => found match: 1 + 1 = 3 => 3 + 1 => found
match: 3 + 1 = 3 => 3
On Thu, Sep 18, 2008 at 11:01 PM, Steven Shaw <steshaw at gmail.com> wrote:
> 2008/9/19 Evan Laforge <qdunkan at gmail.com>
>> let {1 + 1 = 3; 3 + 1 = 3} in 1 + 1 + 1
>
> Which gives 3.
>
> Perhaps even more confusing is:
>
> let {1 + 1 = 3; 3 + 1 = 3} in 3 + 1 + 1
>
> which gives 3
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
More information about the Haskell-Cafe
mailing list