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: Rank beginner question about debugging (Brent Yorgey) 2. Re: Double's (Brent Yorgey) 3. Re: Rank beginner question about debugging (Joe Fredette) 4. Re: Double's (Nicolas Pouillard) 5. Re: Double's (Felipe Lessa) 6. haskell problem (B1lal) 7. Re: haskell problem (Isaac Dupree) 8. Re: haskell problem (Felipe Lessa) 9. Re: haskell problem (Brent Yorgey) ---------------------------------------------------------------------- Message: 1 Date: Tue, 21 Jul 2009 22:43:30 -0400 From: Brent Yorgey <byor...@seas.upenn.edu> Subject: Re: [Haskell-beginners] Rank beginner question about debugging To: beginners@haskell.org Message-ID: <20090722024329.ga24...@seas.upenn.edu> Content-Type: text/plain; charset=us-ascii On Tue, Jul 21, 2009 at 09:26:19AM -0400, Ben Wise wrote: > Folks, > > I'm a rank beginner in Haskell, and though Haskell seems like a great > language to start using, I've got a serious concern about debugging. > > In about 15 years of Lisp experience, then 15 years of C++, I've gotten > pretty accustomed to the idea of using a debugger with lots of pre- and > post-conditions on functions, breakpoints, stack trace, and variable > inspection -- even though it gets tricky with delayed evaluation, > macros, etc. in Lisp! If you think it's tricky in Lisp, it's about ten times as tricky with a lazy language like Haskell! Using gdb with Haskell executables is pretty much useless since the generated code doesn't correspond to the Haskell code in any obvious ways. And it's really hard to make traditional debuggers since the ghc runtime model looks nothing like traditional ones. However, There IS a debugger built into most recent versions of ghci which lets you do some of these things -- have you taken a look at that? I've done quite a bit of programming using the sort of debuggers you describe myself---with C, C++, and Java in particular. And yet in all the Haskell coding I've done over the past few years---some of it quite significant---I've rarely missed those sorts of debuggers. I'm not quite sure I understand the reason why. Perhaps it's partly because Haskell lets you program on such a high level that there's less room for the sorts of titchy errors that debuggers are so good at helping you find. In any case, I wouldn't worry about it too much at this point if I were you, and if you really do find yourself wanting it, take a look at the ghci debugger. -Brent ------------------------------ Message: 2 Date: Tue, 21 Jul 2009 22:45:29 -0400 From: Brent Yorgey <byor...@seas.upenn.edu> Subject: Re: [Haskell-beginners] Double's To: beginners@haskell.org Message-ID: <20090722024529.gb24...@seas.upenn.edu> Content-Type: text/plain; charset=us-ascii On Tue, Jul 21, 2009 at 08:51:05PM -0300, Felipe Lessa wrote: > On Tue, Jul 21, 2009 at 07:10:40PM -0400, Thomas Friedrich wrote: > > I really should have thought about this, but I didn't. > > Note that Rational's are really really really slow, probably it > would be better to spend some time reading Goldberg's paper[1]. > > [1] http://docs.sun.com/source/806-3568/ncg_goldberg.html Premature optimization is the sqrt of all evil. -Brent ------------------------------ Message: 3 Date: Wed, 22 Jul 2009 01:09:42 -0400 From: Joe Fredette <jfred...@gmail.com> Subject: Re: [Haskell-beginners] Rank beginner question about debugging To: Brent Yorgey <byor...@seas.upenn.edu> Cc: beginners@haskell.org Message-ID: <4a669f16.3070...@gmail.com> Content-Type: text/plain; charset="iso-8859-1" I, for one, have never found a need for a more traditional debugger in haskell. Most of my 'bugs' are more accurately described as 'behavior which I did not intend' rather than the more normal description of 'behavior which breaks things'. That is, Haskell programs (almost) always work if they type-check, however, they may work in a way you had not planned on. :) /Joe Brent Yorgey wrote: > On Tue, Jul 21, 2009 at 09:26:19AM -0400, Ben Wise wrote: > >> Folks, >> >> I'm a rank beginner in Haskell, and though Haskell seems like a great >> language to start using, I've got a serious concern about debugging. >> >> In about 15 years of Lisp experience, then 15 years of C++, I've gotten >> pretty accustomed to the idea of using a debugger with lots of pre- and >> post-conditions on functions, breakpoints, stack trace, and variable >> inspection -- even though it gets tricky with delayed evaluation, >> macros, etc. in Lisp! >> > > If you think it's tricky in Lisp, it's about ten times as tricky with > a lazy language like Haskell! Using gdb with Haskell executables is > pretty much useless since the generated code doesn't correspond to the > Haskell code in any obvious ways. And it's really hard to make > traditional debuggers since the ghc runtime model looks nothing like > traditional ones. However, There IS a debugger built into most recent > versions of ghci which lets you do some of these things -- have you > taken a look at that? > > I've done quite a bit of programming using the sort of debuggers you > describe myself---with C, C++, and Java in particular. And yet in all > the Haskell coding I've done over the past few years---some of it > quite significant---I've rarely missed those sorts of debuggers. I'm > not quite sure I understand the reason why. Perhaps it's partly > because Haskell lets you program on such a high level that there's > less room for the sorts of titchy errors that debuggers are so good at > helping you find. In any case, I wouldn't worry about it too much at > this point if I were you, and if you really do find yourself wanting > it, take a look at the ghci debugger. > > -Brent > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners > > -------------- next part -------------- A non-text attachment was scrubbed... Name: jfredett.vcf Type: text/x-vcard Size: 296 bytes Desc: not available Url : http://www.haskell.org/pipermail/beginners/attachments/20090722/90d3440c/jfredett-0001.vcf ------------------------------ Message: 4 Date: Wed, 22 Jul 2009 13:22:55 +0200 From: Nicolas Pouillard <nicolas.pouill...@gmail.com> Subject: Re: [Haskell-beginners] Double's To: Brent Yorgey <byor...@seas.upenn.edu> Cc: beginners <beginners@haskell.org> Message-ID: <1248261727-sup-6...@ausone.local> Content-Type: text/plain; charset=UTF-8 Excerpts from Brent Yorgey's message of Wed Jul 22 04:45:29 +0200 2009: > On Tue, Jul 21, 2009 at 08:51:05PM -0300, Felipe Lessa wrote: > > On Tue, Jul 21, 2009 at 07:10:40PM -0400, Thomas Friedrich wrote: > > > I really should have thought about this, but I didn't. > > > > Note that Rational's are really really really slow, probably it > > would be better to spend some time reading Goldberg's paper[1]. > > > > [1] http://docs.sun.com/source/806-3568/ncg_goldberg.html > > Premature optimization is the sqrt of all evil. +1 Rationals can do their jobs really well, even being much slower than Doubles. -- Nicolas Pouillard http://nicolaspouillard.fr ------------------------------ Message: 5 Date: Wed, 22 Jul 2009 09:23:26 -0300 From: Felipe Lessa <felipe.le...@gmail.com> Subject: Re: [Haskell-beginners] Double's To: beginners@haskell.org Message-ID: <20090722122326.ga28...@kira.casa> Content-Type: text/plain; charset=us-ascii On Tue, Jul 21, 2009 at 10:45:29PM -0400, Brent Yorgey wrote: > On Tue, Jul 21, 2009 at 08:51:05PM -0300, Felipe Lessa wrote: > > Note that Rational's are really really really slow, probably it > > Premature optimization is the sqrt of all evil. I agree, however statistics tend to be very math intensive, and even in simple cases you may end up with a big numerator and a big denominator, totally thrashing your performance. He could write all his functions as taking a (Num a), which would let him choose between both, but if he wants to do that then he must learn how to handle the subtleties of Doubles. (Also Rationals don't support a lot of useful functions like sqrt itself or exp.) -- Felipe. ------------------------------ Message: 6 Date: Wed, 22 Jul 2009 19:21:56 +0100 From: "B1lal" <hbk1_h...@hotmail.com> Subject: [Haskell-beginners] haskell problem To: <beginners@haskell.org> Message-ID: <snt112-ds21b2791efad7a83cea8c7990...@phx.gbl> Content-Type: text/plain; charset="iso-8859-1" im having problem with this Haskell functions female, male :: String -> Bool for finding out the gender for a given name which can be inferred from the title. For example, gender> female "Ms. Green" True gender> female "King Arthur" False gender> male "Mr. Scrooge" True gender> female "Miss Beatrix Potter" True -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/beginners/attachments/20090722/caf5ca66/attachment-0001.html ------------------------------ Message: 7 Date: Wed, 22 Jul 2009 23:01:24 -0400 From: Isaac Dupree <m...@isaac.cedarswampstudios.org> Subject: Re: [Haskell-beginners] haskell problem To: B1lal <hbk1_h...@hotmail.com> Cc: beginners@haskell.org Message-ID: <4a67d284.5050...@isaac.cedarswampstudios.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed B1lal wrote: > im having problem with this Haskell functions > female, male :: String -> Bool > > for finding out the gender for a given name which can be inferred from the > title. Are you trying to implement it? Have you tried Data.List.isPrefixOf? Are you aware of just how many different titles there are in the world, both gender-specific and non-gender-specific (although admittedly fewer and less ambiguous than it is for names)?...Probably some of them will appear after someone's name rather than before, too, and then you get to play with fun contradictory things like "Madam So-and-so, Prince of Wales". This smells like a fishy thing to do, I suppose it's like homework rather than the real world...? P.S. gender discrimination! :-P -Isaac ------------------------------ Message: 8 Date: Thu, 23 Jul 2009 00:11:47 -0300 From: Felipe Lessa <felipe.le...@gmail.com> Subject: Re: [Haskell-beginners] haskell problem To: beginners@haskell.org Message-ID: <20090723031147.ga21...@kira.casa> Content-Type: text/plain; charset=us-ascii On Wed, Jul 22, 2009 at 07:21:56PM +0100, B1lal wrote: > im having problem with this Haskell functions > female, male :: String -> Bool female = not . male male = not . female :) -- Felipe. ------------------------------ Message: 9 Date: Thu, 23 Jul 2009 00:11:15 -0400 From: Brent Yorgey <byor...@seas.upenn.edu> Subject: Re: [Haskell-beginners] haskell problem To: beginners@haskell.org Message-ID: <20090723041115.ga25...@seas.upenn.edu> Content-Type: text/plain; charset=us-ascii On Wed, Jul 22, 2009 at 07:21:56PM +0100, B1lal wrote: > im having problem with this Haskell functions > female, male :: String -> Bool > > for finding out the gender for a given name which can be inferred from the > title. > > For example, > > gender> female "Ms. Green" > > True > > gender> female "King Arthur" > > False > > gender> male "Mr. Scrooge" > > True > > gender> female "Miss Beatrix Potter" > > True What have you tried so far? What specifically are you having problems with? This sounds a lot like a homework problem; we are happy to help you with specific problems but in general we won't do your homework for you. -Brent ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 13, Issue 12 *****************************************