Send Beginners mailing list submissions to
        beginners@haskell.org

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:  Alternating sequence (Andrew Wagner)
   2. Re:  Using read, reads... (Henk-Jan van Tuyl)
   3. Re:  Using read, reads... (Rafael Gustavo da Cunha Pereira Pinto)
   4.  beginners mailing list should be beginner's choice (Dan Weston)
   5. Re:  Re: New List (Benjamin L.Russell)
   6. Re:  Exercises for beginners and Natural Tansformations
      (Benjamin L.Russell)
   7. Re:  Re: New List (Angelos Sphyris)


----------------------------------------------------------------------

Message: 1
Date: Mon, 21 Jul 2008 12:01:47 -0400
From: "Andrew Wagner" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] Alternating sequence
To: "Dirk Markert" <[EMAIL PROTECTED]>
Cc: beginners@haskell.org
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1

Another way to define 'rule' here, just for kicks:
rule = 2 : 4 : rule


On Mon, Jul 21, 2008 at 11:57 AM, Dirk Markert <[EMAIL PROTECTED]> wrote:
> Hi Kurt,
>
> thank you for the detailed explanation. Indeed, I could follow your
> explanation on first reading :-)
>
> Dirk
>
> 2008/7/21 Kurt Hutchinson <[EMAIL PROTECTED]>:
>>
>> On Mon, Jul 21, 2008 at 9:34 AM, Dirk Markert <[EMAIL PROTECTED]>
>> wrote:
>> > I am trying to generate the following list:
>> > 2, 3, 5 -- and then alternating (+2) resp (+4) -- 7, 11, 13, 17, 19, 23
>> >
>> > I came up with the following solution
>> > 2:3:unfoldr (\(a,b) -> Just (a,(a+b, if b == 2 then 4 else 2))) (5,2)
>> >
>> > Are there easier ways to generate the desired list?
>>
>>
>> So you've got the beginnings of an infinite list, and a rule to modify
>> that to generate new elements. How about turning that rule into a list
>> of its own, and then combining them?
>>
>>  rule = cycle [ 2, 4 ]  -- this will give an infinite list of 2's and 4's
>>
>> Combining two lists is usually done with 'zip'. But in this case, we
>> don't just want tuples, we want the sum of each pair. You can combine
>> lists with a function by using 'zipWith'. Start at the point where the
>> rule kicks in.
>>
>>  rest = 5 : zipWith (+) rest rule
>>
>> Now just tack on your first elements.
>>
>>  list = 2 : 3 : rest
>>
>> Here it is all in one place:
>>
>>  list = 2 : 3 : rest
>>    where
>>    rule = cycle [ 2, 4 ]
>>    rest = 5 : zipWith (+) rest rule
>>
>> Kurt
>
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>


------------------------------

Message: 2
Date: Mon, 21 Jul 2008 21:14:37 +0200
From: "Henk-Jan van Tuyl" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] Using read, reads...
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; format=flowed; delsp=yes;
        charset=iso-8859-15

On Mon, 21 Jul 2008 06:51:27 +0200, Felipe Lessa <[EMAIL PROTECTED]>
wrote:
> On Sun, Jul 20, 2008 at 10:30 PM, Rafael Gustavo da Cunha Pereira
> Pinto <[EMAIL PROTECTED]> wrote:
>
> convert :: String -> [Int]
> convert = map read . words
>
> read :: FilePath -> IO [[Int]]
> read fp = (map convert . lines) `fmap` readFile fp
>

If a single list of Ints is OK, the code can be much simpler:

> read' :: FilePath -> IO [Int]
> read' fp = (map read . words) `fmap` readFile fp


-- 
Met vriendelijke groet,
Henk-Jan van Tuyl


--
http://functor.bamikanarie.com
http://Van.Tuyl.eu/
--



------------------------------

Message: 3
Date: Mon, 21 Jul 2008 19:47:10 -0300
From: "Rafael Gustavo da Cunha Pereira Pinto" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] Using read, reads...
To: beginners@haskell.org
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

Thanks, but what I needed was a line-by-line analyser.

I ended up with Felipe's solution.

Thank you all!

On Mon, Jul 21, 2008 at 16:14, Henk-Jan van Tuyl <[EMAIL PROTECTED]> wrote:

> On Mon, 21 Jul 2008 06:51:27 +0200, Felipe Lessa <[EMAIL PROTECTED]>
> wrote:
>
>> On Sun, Jul 20, 2008 at 10:30 PM, Rafael Gustavo da Cunha Pereira
>> Pinto <[EMAIL PROTECTED]> wrote:
>>
>> convert :: String -> [Int]
>> convert = map read . words
>>
>> read :: FilePath -> IO [[Int]]
>> read fp = (map convert . lines) `fmap` readFile fp
>>
>>
> If a single list of Ints is OK, the code can be much simpler:
>
>  read' :: FilePath -> IO [Int]
>> read' fp = (map read . words) `fmap` readFile fp
>>
>
>
> --
> Met vriendelijke groet,
> Henk-Jan van Tuyl
>
>
> --
> http://functor.bamikanarie.com
> http://Van.Tuyl.eu/
> --
>
>
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>



-- 
Rafael Gustavo da Cunha Pereira Pinto
Electronic Engineer, MSc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20080721/cd21faf7/attachment-0001.htm

------------------------------

Message: 4
Date: Mon, 21 Jul 2008 10:48:39 -0700
From: Dan Weston <[EMAIL PROTECTED]>
Subject: [Haskell-begin] beginners mailing list should be beginner's
        choice
To: "C.M.Brown" <[EMAIL PROTECTED]>
Cc: Fernando Rodriguez <[EMAIL PROTECTED]>, beginners@haskell.org,
        [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="ISO-8859-1"; format=flowed

Just to avoid any misunderstanding...

I am certain that C.M. Brown meant to say "CC'ed the Haskell-beginners 
mailing list" instead of "moved", but I think it's worth emphasizing 
that the new beginners list was ostensibly created for various discussed 
reasons, but all to provide a more tailored forum for beginners, not to 
restrict participation on haskell-cafe. Words like "move" could sound to 
a beginner like a dismissal or demotion.

(This policy is clearly different from the haskell list, which has a 
much stronger collegially-enforced moderation policy limited to 
announcements.)

I would hate to think that people on the beginners list might worry that 
their questions were not "good enough" to join the "grown-ups" on 
haskell-cafe. I think CC'ing to beginners is hint enough, and soon 
enough people will choose the best forum for their comfort level.

Dan

C.M.Brown wrote:
> Hi Fernando,
> 
> I hope you don't mind, but I've moved this over to the Haskell-beginners
> mailing list, where I think this kind of question will be more
> appropriate.




------------------------------

Message: 5
Date: Tue, 22 Jul 2008 12:30:15 +0900
From: Benjamin L.Russell <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] Re: New List
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii

On Fri, 18 Jul 2008 17:56:59 -0400, John Dorsey <[EMAIL PROTECTED]>
wrote:

>I already filter on something else.  I proposed adding the prefix for
>two reasons:  (1) I file all my haskell-related lists into the same
>box, and the prefix is handy for quickly telling which one I'm reading.
>This can make the difference between, say, suggesting unsafePerformIO
>(in the cafe) or a brief explanation of IO (on this list).  And (2) for
>conistency with [Haskell] and [Haskell-cafe].

I see your point:  You would appreciate being able to use
"[Haskell-begin] unsafePerformIO" vs. "[Haskell-cafe] unsafePerformIO"
to differentiate between a brief explanation of IO on
Haskell-Beginners vs. suggesting unsafePerformIO on Haskell-Cafe.

That actually is a valid point, and could prove useful at times.

Apart from just consistency with "[Haskell]" and "[Haskell-cafe]" in
the prefix for the subject lines of Haskell and Haskell-Cafe, it seems
that a prefix would be useful in ensuring consistency in having this
mailing list referred to as "Haskell-Beginners," and not just
"Beginners," by new members.  Otherwise, the fact that the e-mail
address is beginners@haskell.org, and not
[EMAIL PROTECTED], could create confusion.  New members
would probably start saying "Haskell" vs. "Haskell-Cafe" vs.
"Beginners," leading to further inconsistencies in the proper names.
Eventually, most people would just start calling this list "Beginners"
because the name is shorter, and the name "Haskell-Beginners" would
become mostly forgotten.  However, if the prefix referred to the
proper name of the list in every message, this confusion could be
minimized.

>It's not important to me.  Sounds like the majority are for no prefix.

Nonetheless, you had a valid point, and many users had stated that as
long as the prefix was short, the presence or absence of the prefix
did not really matter to them.  Ideally, my personal preference would
be to be completely consistent with [Haskell] and [Haskell-cafe], and
change the prefix to [Haskell-beginners], but it seems that then many
readers would believe this prefix to be too long and make the subject
line hard to read.

For the sake of argument, let's experiment:

[Haskell-begin] unsafePerformIO
[Haskell-beginners] unsafePerformIO

Now, let's try a longer example:

[Haskell-begin] beginners mailing list should be beginner's choice
[Haskell-beginners] beginners mailing list should be beginner's choice

Right now, in my Yahoo! Mail Haskell-Cafe folder, a typical truncated
long subject-line message reads as follows:

[Haskell-cafe] ghc 6.8.3 build error with __DISCARD__ linking problem,
please hel

That's 81 characters.

Right now, the longest example that I can find of a subject line in
Haskell-Beginners is the following:

[Haskell-begin] Re: [Haskell-cafe] Trouble with non-exhaustive
patterns

That's 71 characters, using "[Haskell-begin]."  If we changed
"[Haskell-begin]" to "[Haskell-beginners]," that would add 4
characters, increasing the length to 75.  That's still below 81.
Here's a comparison:

[Haskell-begin] Re: [Haskell-cafe] Trouble with non-exhaustive
patterns
[Haskell-beginners] Re: [Haskell-cafe] Trouble with non-exhaustive
patterns

Given that some mailing lists, such as plt-announce, already get by
using prefixes of similar length (in their case, "[PLT
announcement]," I think that in practice, after a few weeks, most
readers would probably unconsciously just ignore the prefix and read
the rest, and new readers would be able to read "[Haskell]" vs.
"[Haskell-cafe]" vs. "[Haskell-beginners]" for consistency (although
some users would probably complain at first).

Just for comparison, here are some examples of what is happening with
the subject lines in plt-announce:

[PLT announcement] PLT Scheme v4.0
[PLT announcement] PLT Scheme v4.0.2

Let's compare what would happen with similar typical subject lines
with "[Haskell-begin]" vs. "[Haskell-beginners]":

[Haskell-begin] Exercises for beginners and Natural Tansformations
[Haskell-beginners] Exercises for beginners and Natural Tansformations

What do you think?  Opinions, comment?  You decide.

-- Benjamin L. Russell



------------------------------

Message: 6
Date: Tue, 22 Jul 2008 15:28:28 +0900
From: Benjamin L.Russell <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] Exercises for beginners and Natural
        Tansformations
To: beginners@haskell.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=us-ascii

On Sat, 19 Jul 2008 10:00:12 -0300, "Federico Brubacher"
<[EMAIL PROTECTED]> wrote:

>Hi all,
>I think i will love this list :)

Thank you.  Please let us know if you have any suggestions for
improvement, comments, criticism, etc.

> [...]
>
>My friend who is more advanced in Haskell said this approach is good because
>you get to learn natural Transformations. So I googled that and I came up
>with this [2]. I can read al little bit of category theory but I would love
>to know how to apply [2] in the sum exercise.
>
> [...]
>
>[1] http://blog.tmorris.net/haskell-exercises-for-beginners/

It seems that you forgot to include the link to [2].  Which reference
was that?

-- Benjamin L. Russell



------------------------------

Message: 7
Date: Tue, 22 Jul 2008 13:49:19 +0300
From: "Angelos Sphyris" <[EMAIL PROTECTED]>
Subject: Re: [Haskell-begin] Re: New List
To: <beginners@haskell.org>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

I believe that using beginners@haskell.org and [Haskell-begin] in the subject 
line may confuse people. 
So, I would opt for [Haskell-beginners]. 

Angelos


----- Original Message ----- 
From: "Benjamin L.Russell" <[EMAIL PROTECTED]>
To: <beginners@haskell.org>
Sent: Tuesday, July 22, 2008 6:30 AM
Subject: Re: [Haskell-begin] Re: New List


> On Fri, 18 Jul 2008 17:56:59 -0400, John Dorsey <[EMAIL PROTECTED]>
> wrote:
> 
>>I already filter on something else.  I proposed adding the prefix for
>>two reasons:  (1) I file all my haskell-related lists into the same
>>box, and the prefix is handy for quickly telling which one I'm reading.
>>This can make the difference between, say, suggesting unsafePerformIO
>>(in the cafe) or a brief explanation of IO (on this list).  And (2) for
>>conistency with [Haskell] and [Haskell-cafe].
> 
> I see your point:  You would appreciate being able to use
> "[Haskell-begin] unsafePerformIO" vs. "[Haskell-cafe] unsafePerformIO"
> to differentiate between a brief explanation of IO on
> Haskell-Beginners vs. suggesting unsafePerformIO on Haskell-Cafe.
> 
> That actually is a valid point, and could prove useful at times.
> 
> Apart from just consistency with "[Haskell]" and "[Haskell-cafe]" in
> the prefix for the subject lines of Haskell and Haskell-Cafe, it seems
> that a prefix would be useful in ensuring consistency in having this
> mailing list referred to as "Haskell-Beginners," and not just
> "Beginners," by new members.  Otherwise, the fact that the e-mail
> address is beginners@haskell.org, and not
> [EMAIL PROTECTED], could create confusion.  New members
> would probably start saying "Haskell" vs. "Haskell-Cafe" vs.
> "Beginners," leading to further inconsistencies in the proper names.
> Eventually, most people would just start calling this list "Beginners"
> because the name is shorter, and the name "Haskell-Beginners" would
> become mostly forgotten.  However, if the prefix referred to the
> proper name of the list in every message, this confusion could be
> minimized.
> 
>>It's not important to me.  Sounds like the majority are for no prefix.
> 
> Nonetheless, you had a valid point, and many users had stated that as
> long as the prefix was short, the presence or absence of the prefix
> did not really matter to them.  Ideally, my personal preference would
> be to be completely consistent with [Haskell] and [Haskell-cafe], and
> change the prefix to [Haskell-beginners], but it seems that then many
> readers would believe this prefix to be too long and make the subject
> line hard to read.
> 
> For the sake of argument, let's experiment:
> 
> [Haskell-begin] unsafePerformIO
> [Haskell-beginners] unsafePerformIO
> 
> Now, let's try a longer example:
> 
> [Haskell-begin] beginners mailing list should be beginner's choice
> [Haskell-beginners] beginners mailing list should be beginner's choice
> 
> Right now, in my Yahoo! Mail Haskell-Cafe folder, a typical truncated
> long subject-line message reads as follows:
> 
> [Haskell-cafe] ghc 6.8.3 build error with __DISCARD__ linking problem,
> please hel
> 
> That's 81 characters.
> 
> Right now, the longest example that I can find of a subject line in
> Haskell-Beginners is the following:
> 
> [Haskell-begin] Re: [Haskell-cafe] Trouble with non-exhaustive
> patterns
> 
> That's 71 characters, using "[Haskell-begin]."  If we changed
> "[Haskell-begin]" to "[Haskell-beginners]," that would add 4
> characters, increasing the length to 75.  That's still below 81.
> Here's a comparison:
> 
> [Haskell-begin] Re: [Haskell-cafe] Trouble with non-exhaustive
> patterns
> [Haskell-beginners] Re: [Haskell-cafe] Trouble with non-exhaustive
> patterns
> 
> Given that some mailing lists, such as plt-announce, already get by
> using prefixes of similar length (in their case, "[PLT
> announcement]," I think that in practice, after a few weeks, most
> readers would probably unconsciously just ignore the prefix and read
> the rest, and new readers would be able to read "[Haskell]" vs.
> "[Haskell-cafe]" vs. "[Haskell-beginners]" for consistency (although
> some users would probably complain at first).
> 
> Just for comparison, here are some examples of what is happening with
> the subject lines in plt-announce:
> 
> [PLT announcement] PLT Scheme v4.0
> [PLT announcement] PLT Scheme v4.0.2
> 
> Let's compare what would happen with similar typical subject lines
> with "[Haskell-begin]" vs. "[Haskell-beginners]":
> 
> [Haskell-begin] Exercises for beginners and Natural Tansformations
> [Haskell-beginners] Exercises for beginners and Natural Tansformations
> 
> What do you think?  Opinions, comment?  You decide.
> 
> -- Benjamin L. Russell
> 
> _______________________________________________
> Beginners mailing list
> Beginners@haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://www.haskell.org/pipermail/beginners/attachments/20080722/9d9dccee/attachment.htm

------------------------------

_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners


End of Beginners Digest, Vol 1, Issue 11
****************************************

Reply via email to