Send Beginners mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://www.haskell.org/mailman/listinfo/beginners
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beginners digest..."
Today's Topics:
1. Re: Case statements shorter ([email protected])
----------------------------------------------------------------------
Message: 1
Date: Tue, 2 Nov 2010 18:46:17 +0000
From: "[email protected]" <[email protected]>
Subject: Re: [Haskell-beginners] Case statements shorter
To: Roel van Dijk <[email protected]>
Cc: "[email protected]" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes
Nice distinction! Thank you for the correction.
Il giorno 02/nov/2010, alle ore 09.11, Roel van Dijk <[email protected]
> ha scritto:
> On Mon, Nov 1, 2010 at 7:23 PM, [email protected] <[email protected]>
> wrote:
>> * _ is not a special keyword in haskell. It's a regular variable so
>> will
>> always match. It's usually used when you don't use it's value in
>> the right
>> hand side or when it adds no information. In this case its value
>> will be n
>> so there is no reason to introduce another name.
>
> This is incorrect. _ is a pattern not a variable.
>
> I can write
>
> f (_:_) = "bla"
>
> but not
>
> f (x:x) = "bla"
> Conflicting definitions for `x' In the definition of `f'
>
> So _ is a pattern that always matches but is never bound to a value.
>
> Regards,
> Roel
------------------------------
_______________________________________________
Beginners mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/beginners
End of Beginners Digest, Vol 29, Issue 4
****************************************