[Haskell] Haskell [x] and x notation - as-pattern example

2013-04-03 Thread Angus Comber
I am reading Learn you a Haskell for great good and on page 40 - as-patterns. I have changed the example slightly to be: firstLetter :: String -> String firstLetter "" = "Empty string, oops" firstLetter all@(x:xs) = "The first letter of " ++ all ++ " is " ++ [x] ++ " otherbit " ++ xs Then can use

Re: [Haskell] Haskell [x] and x notation - as-pattern example

2013-04-03 Thread Chernin, Nadav
Hi, Write firstLetter all@(x:xs) = "The first letter of " ++ all ++ " is " ++ [x] ++ " otherbit " ++ xs Nadav From: haskell-boun...@haskell.org [mailto:haskell-boun...@haskell.org] On Behalf Of Angus Comber Sent: Wednesday, April 03, 2013 12:01 PM To: Haskell Mailing List Subject: [Haskell] Has

Re: [Haskell] Haskell [x] and x notation - as-pattern example

2013-04-03 Thread Henning Thielemann
On Wed, 3 Apr 2013, Angus Comber wrote: I am reading Learn you a Haskell for great good and on page 40 - as-patterns. This question is certainly better for the beginners list: http://www.haskell.org/mailman/listinfo/beginners In your case x :: Char xs :: [Char] [x] :: Char Tha

Re: [Haskell] Haskell [x] and x notation - as-pattern example

2013-04-03 Thread Denis Kasak
On 3 April 2013 11:15, Henning Thielemann wrote: >x :: Char >xs :: [Char] > >[x] :: Char > You meant [x] :: [Char] here, of course. :-) -- Denis Kasak ___ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/hask

Re: [Haskell] Haskell [x] and x notation - as-pattern example

2013-04-03 Thread Daniel Frumin
> Also xs is of what type? list of values? So does this mean x is an element > and xs must be of type list Exactly.  x is of type Char and xs is of type [Char]. The list concatenation function (++) expects both of its arguments to be lists, so that's the reason you need to turn a Char x into a l

Re: [Haskell] Haskell [x] and x notation - as-pattern example

2013-04-03 Thread Brandon Allbery
On Wed, Apr 3, 2013 at 5:01 AM, Angus Comber wrote: > In the (x:xs) : just delimits each element. so x is the first element. Why > can I not print by using x? > > Also xs is of what type? list of values? So does this mean x is an element > and xs must be of type list? Confused... > Actually, you

Re: [Haskell] Haskell [x] and x notation - as-pattern example

2013-04-03 Thread Angus Comber
Yes it seems that ++ concatenates lists not elements and that was the underlying problem. I have subscribed to the beginners list - didn't know there was one for people like me just starting to walk :) On 3 April 2013 14:39, Brandon Allbery wrote: > On Wed, Apr 3, 2013 at 5:01 AM, Angus Comber

[Haskell] ANN: adobe-swatch-exchange-0.1.0.0

2013-04-03 Thread Jeremy Shaw
I am pleased to annouce the release of adobe-swatch-exchange 0.1.0.0. My primary motivation in writing this is to make it easier to download color swatches from http://kuler.adobe.com/ and test them on my site. Though, perhaps there is already a great way of doing this and I didn't look hard enoug

[Haskell] Haskell Weekly News: Issue 264

2013-04-03 Thread Daniel Santa Cruz
Welcome to issue 264 of the HWN, an issue covering crowd-sourced bits of information about Haskell from around the web. This issue covers the week of March 17 to 30, 2013. Quotes of the Week * ddarius: (f x) is a partial application iff f x == (curry (uncurry f) x) * flebron: "Hey, I