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 beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. Re: state monad (Brandon Allbery) 2. Re: Fwd: Implementing a spellchecker - problem with Data.HashTable performance (Rados?aw Szymczyszyn) 3. Cyclic structures (David Tchepak) 4. Re: Cyclic structures (Adrien Haxaire) 5. Re: Fwd: Implementing a spellchecker - problem with Data.HashTable performance (Osager Prairie) ---------------------------------------------------------------------- Message: 1 Date: Sun, 22 Apr 2012 06:43:21 -0400 From: Brandon Allbery <allber...@gmail.com> Subject: Re: [Haskell-beginners] state monad To: Paul Higham <polyg...@mac.com> Cc: Beginners@haskell.org Message-ID: <cakfcl4xwfchq0bhxq2uup-hwk5sx12q5ax1xpuek3tprmtp...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" On Sun, Apr 22, 2012 at 04:40, Paul Higham <polyg...@mac.com> wrote: > stackPlay.hs:6:7: Not in scope: data constructor `State' > > Please excuse the cognitive deficit, but I cannot figure out why this > should not work as advertised. > Not your fault; things were rearranged in the library, and `State` is no longer a distinct type (it's `StateT Identity` now). `state` (lowercase) is the replacement for the old `State` constructor. -- brandon s allbery allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20120422/47ce155d/attachment-0001.htm> ------------------------------ Message: 2 Date: Sun, 22 Apr 2012 16:58:52 +0200 From: Rados?aw Szymczyszyn <lav...@gmail.com> Subject: Re: [Haskell-beginners] Fwd: Implementing a spellchecker - problem with Data.HashTable performance Cc: beginners@haskell.org Message-ID: <CAG=dco3c6ujnx-qubyjwl05jpzow+bhn8q_egn-uad0zy4p...@mail.gmail.com> Content-Type: text/plain; charset=UTF-8 Thank you all for thoughts and suggestions. I've been tracking them as they appeared, but being busy with university assignments, couldn't try them out yet. In the meantime, however, Karol Samborski investigated the issue further and found the cause of poor performance -- somehow using HashTable.newHint doesn't play well with HashTable.update. Simply changing newHint to hint gives me execution time of about 12s (on my rather slowish AMD Fusion 1.6GHz laptop) with a dataset of ~1.35mln words. It's evidently a bug, as newHint would hardly be expected to slow things down. I'm yet to discover how to properly report it. Thanks again to all who responded and especially to Karol for solving the problem. Best regards, Radek Szymczyszyn ------------------------------ Message: 3 Date: Mon, 23 Apr 2012 16:00:09 +1000 From: David Tchepak <tche...@gmail.com> Subject: [Haskell-beginners] Cyclic structures To: beginners@haskell.org Message-ID: <CAOeLS_8WCrDz_QVecbJ=bhfj66k22586y9x3+ceufd+ufre...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" I'm currently reading the first edition of "Introduction to Functional Programming" by Richard Bird and Philip Wadler. Section 7.6 is on cyclic structures, and has the following example: ones = forever 1 forever x = x : forever x Which, after 5 evaluations, produces a graph like: 1 : 1 : 1 : 1 : 1 : forever 1 The book then has a re-written version of `forever` that looks like this: forever x = zs where zs = x : zs Which instead produces a cyclic structure: * 1 : ^-----| So it takes up a fixed amount of space, despite being an infinite list. I was hoping someone could explain the difference between the first and second `forever`s for me. Does the second version become a cyclic graph because the `zs` intermediate expression has no additional arguments so doesn't need to be reduced further? Or do both end up being optimised the same by GHC? (my newbie attempts to profile show the second takes up a bit less space, but I'm not sure if I'm measuring it right). Appreciate any help. Regards, David -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://www.haskell.org/pipermail/beginners/attachments/20120423/d22d0495/attachment-0001.htm> ------------------------------ Message: 4 Date: Mon, 23 Apr 2012 09:45:53 +0200 From: Adrien Haxaire <adr...@haxaire.org> Subject: Re: [Haskell-beginners] Cyclic structures To: <beginners@haskell.org> Message-ID: <04475597a810a1dd7cf901692c6b2...@haxaire.org> Content-Type: text/plain; charset=UTF-8; format=flowed Hi, I do not have the answer to your question, but you might be interested in the video about streams by Graham Hutton: http://channel9.msdn.com/Shows/Going+Deep/C9-Lectures-Graham-Hutton-How-To-Be-More-Productive Adrien On Mon, 23 Apr 2012 16:00:09 +1000, David Tchepak wrote: > Im currently reading the first edition of "Introduction to Functional > Programming" by Richard Bird and Philip Wadler. Section 7.6 is on > cyclic structures, and has the following example: > > ? ones = forever 1 > ? forever x = x : forever x > > Which, after 5 evaluations, produces a graph like: > > ? 1 : 1 : 1 : 1 : 1 : forever 1 > > The book then has a re-written version of `forever` that looks like > this: > > ? forever x = zs > ? ? where zs = x : zs > > Which instead produces a cyclic structure: > > ? * 1 :? > ? ^-----| > > So it takes up a fixed amount of space, despite being an infinite > list. > > I was hoping someone could explain the difference between the first > and second `forever`s for me. Does the second version become a cyclic > graph because the `zs` intermediate expression has no additional > arguments so doesnt need to be reduced further? Or do both end up > being optimised the same by GHC? (my newbie attempts to profile show > the second takes up a bit less space, but Im not sure if Im measuring > it right). > > Appreciate any help. > Regards, > David -- Adrien Haxaire www.adrienhaxaire.org | @adrienhaxaire ------------------------------ Message: 5 Date: Mon, 23 Apr 2012 11:01:00 +0200 From: Osager Prairie <osagerprai...@gmail.com> Subject: Re: [Haskell-beginners] Fwd: Implementing a spellchecker - problem with Data.HashTable performance To: Rados?aw Szymczyszyn <lav...@gmail.com> Cc: beginners@haskell.org Message-ID: <ca+q7gyaehncsmfqwm73rxequen5kqd2ca9pesmn9tjg-ney...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" Hi: Your post is very interesting. I'm also a beginner so can not offer you much suggestions. Only that I saw this book the other day and think it might be helpful for you. Computational Semantics with Functional Programming<http://www.amazon.com/Computational-Semantics-Functional-Programming-Eijck/dp/0521760305> This book use haskell as the programming language Best regards On Sun, Apr 22, 2012 at 4:58 PM, Rados?aw Szymczyszyn <lav...@gmail.com>wrote: > Thank you all for thoughts and suggestions. I've been tracking them as > they appeared, but being busy with university assignments, couldn't > try them out yet. > > In the meantime, however, Karol Samborski investigated the issue > further and found the cause of poor performance -- somehow using > HashTable.newHint doesn't play well with HashTable.update. Simply > changing newHint to hint gives me execution time of about 12s (on my > rather slowish AMD Fusion 1.6GHz laptop) with a dataset of ~1.35mln > words. > > It's evidently a bug, as newHint would hardly be expected to slow > things down. I'm yet to discover how to properly report it. > > Thanks again to all who responded and especially to Karol for solving > the problem. > > Best regards, > Radek Szymczyszyn > > _______________________________________________ > 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/20120423/b99f771c/attachment-0001.htm> ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 46, Issue 40 *****************************************