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: Ranges and List Comprehensions in SQL (Brent Yorgey) 2. Too lazy/Too strict (Alex Rozenshteyn) 3. Motivation to Learn Haskell (Lorenzo Isella) 4. Re: Motivation to Learn Haskell (Tim Perry) 5. Re: Motivation to Learn Haskell (Benjamin L. Russell) 6. Real world example of Typeclasses > Interfaces (Alec Benzer) 7. dealing with chained functions (Alec Benzer) ---------------------------------------------------------------------- Message: 1 Date: Fri, 3 Sep 2010 14:07:42 -0400 From: Brent Yorgey <byor...@seas.upenn.edu> Subject: Re: [Haskell-beginners] Ranges and List Comprehensions in SQL To: Toby Thain <t...@telegraphics.com.au> Cc: beginners@haskell.org Message-ID: <20100903180742.ga28...@seas.upenn.edu> Content-Type: text/plain; charset=us-ascii On Fri, Sep 03, 2010 at 12:09:01PM -0400, Toby Thain wrote: > > On 3-Sep-10, at 11:43 AM, Brent Yorgey wrote: > > >On Fri, Sep 03, 2010 at 11:21:27AM -0400, Tom Murphy wrote: > >... > >>The record would actually be coming from an SQL database. > >>I would like to be able to store a large list in SQL records, > >>without having > >>to store every element. > > > > I see no downside whatsoever to "storing every element". It's what an > RDBMS does: manage relations. Good point. I initially meant to write something about "premature optimization" in my email but then forgot. -Brent ------------------------------ Message: 2 Date: Sat, 4 Sep 2010 00:17:13 +0300 From: Alex Rozenshteyn <rpglove...@gmail.com> Subject: [Haskell-beginners] Too lazy/Too strict To: beginners <beginners@haskell.org> Message-ID: <aanlktintuzbp0rr1ovpo90a6+s+a3mm24mefpdhtw...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" I'm trying to take an html page whose last pre tag contains a hexdump and write the hex out as an executable. Link to truncated html example: http://pastebin.com/ENMDrsAT Link to my code: http://pastebin.com/XY0wgM6r I've got a memory leak somewhere, likely due to laziness, and I would appreciate help in finding it; this is the first one i've encountered, so I'm a bit clueless. -- Alex R -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/beginners/attachments/20100903/9cac6826/attachment-0001.html ------------------------------ Message: 3 Date: Sat, 04 Sep 2010 00:57:26 +0200 From: Lorenzo Isella <lorenzo.ise...@gmail.com> Subject: [Haskell-beginners] Motivation to Learn Haskell To: beginners@haskell.org Message-ID: <4c817d56.1040...@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Dear All, It is my first post to this list and please do not take it as an attempt to start any flamewar. From time to time, I try to find the motivation to learn at least the fundamentals of another programming language. I normally use R and Python on a daily basis (but I am not that much into OO programming) and have a good knowledge of Fortran and a rather superficial one of C. Beside learning a new language as a sort of mind expanding exercise, I try to figure out how and if it can save me some time in my work and how it measures up against other languages. These days I tend to rely on R for data analysis and visualization whereas I use Python (in particular Numpy+SciPy) for number crunching (it is very convenient to use scipy/numpy to solve ODE's, manipulate arrays and so on). Now, I wonder what benefit I would gain from learning Haskell since I mainly write codes for numerical simulations/data analysis. I know Haskell is gaining momentum e.g. in the financial environment (I happened to see Haskell knowledge as a specification in some quant jobs) hence it must be more than suitable for numerical work and, by the little I have understood so far, it allows one to write code really resembling mathematical expressions (I was impressed by guards and curried functions). However, it also looks to me (correct me if I am mistaken) that Haskell is a far cry from the wealth of standard and contributed scientific modules you have in Python or R and thanks to which you do not re-implement the wheel yourself. Any thoughts/suggestions are really appreciated. Cheers Lorenzo ------------------------------ Message: 4 Date: Fri, 3 Sep 2010 16:30:21 -0700 (PDT) From: Tim Perry <perry2...@yahoo.com> Subject: Re: [Haskell-beginners] Motivation to Learn Haskell To: Lorenzo Isella <lorenzo.ise...@gmail.com>, beginners@haskell.org Message-ID: <904372.14045...@web54306.mail.re2.yahoo.com> Content-Type: text/plain; charset=us-ascii You might find this discussion started by a skeptic interesting (I did): http://www.reddit.com/r/haskell/comments/cs54i/how_would_you_write_du_in_haskell/ The topic is different, but the responses tell me: - Lots of library code that I expect to be written already doesn't exist for Haskell. - This isn't so bad as the code you have write is relatively succinct. - You still have to write the missing code. Which sucks (tm). I'm using Haskell for lots of one-off data processing. It is generally quick to develop. It generally yields type errors rather than gibberish when I write something stupid in my code. I recommend it. But I've never used SciPy so I can't comment on the relative depth of the libraries. With all that said, there are are libraries with the obvious statistical methods: http://hackage.haskell.org/package/#cat:statistics http://hackage.haskell.org/package/statistics http://hackage.haskell.org/packages/archive/hstats/0.3/doc/html/Math-Statistics.html If you do jump in, I'd recommend the Real World Haskell book or the The Haskell School of Expression book. Good luck, Tim ----- Original Message ---- From: Lorenzo Isella <lorenzo.ise...@gmail.com> To: beginners@haskell.org Sent: Fri, September 3, 2010 3:57:26 PM Subject: [Haskell-beginners] Motivation to Learn Haskell Dear All, It is my first post to this list and please do not take it as an attempt to start any flamewar. >From time to time, I try to find the motivation to learn at least the fundamentals of another programming language. I normally use R and Python on a daily basis (but I am not that much into OO programming) and have a good knowledge of Fortran and a rather superficial one of C. Beside learning a new language as a sort of mind expanding exercise, I try to figure out how and if it can save me some time in my work and how it measures up against other languages. These days I tend to rely on R for data analysis and visualization whereas I use Python (in particular Numpy+SciPy) for number crunching (it is very convenient to use scipy/numpy to solve ODE's, manipulate arrays and so on). Now, I wonder what benefit I would gain from learning Haskell since I mainly write codes for numerical simulations/data analysis. I know Haskell is gaining momentum e.g. in the financial environment (I happened to see Haskell knowledge as a specification in some quant jobs) hence it must be more than suitable for numerical work and, by the little I have understood so far, it allows one to write code really resembling mathematical expressions (I was impressed by guards and curried functions). However, it also looks to me (correct me if I am mistaken) that Haskell is a far cry from the wealth of standard and contributed scientific modules you have in Python or R and thanks to which you do not re-implement the wheel yourself. Any thoughts/suggestions are really appreciated. Cheers Lorenzo _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners ------------------------------ Message: 5 Date: Sat, 04 Sep 2010 09:30:53 +0900 From: dekudekup...@yahoo.com (Benjamin L. Russell) Subject: [Haskell-beginners] Re: Motivation to Learn Haskell To: beginners@haskell.org Message-ID: <m2aanyfiyq....@yahoo.com> Content-Type: text/plain; charset=us-ascii Tim Perry <perry2...@yahoo.com> writes: > If you do jump in, I'd recommend the Real World Haskell book or the The > Haskell > School of Expression book. Another interesting title is _Programming in Haskell,_ by Graham Hutton (see http://www.cs.nott.ac.uk/~gmh/book.html). Duncan Coutts has written a review on the title (see http://www.cs.nott.ac.uk/~gmh/book-review.pdf). As for motivation for learning Haskell, one motivator is the purely functional nature of the language, which is referentially transparent and therefore facilitates reasoning about programs. Haskell has roots in category theory, and therefore, it is frequently possible to use category-theoretical reasoning to reason about the correctness of programs; this cannot be said of most other programming languages. -- Benjamin L. Russell > > Good luck, > Tim > > > > > > ----- Original Message ---- > From: Lorenzo Isella <lorenzo.ise...@gmail.com> > To: beginners@haskell.org > Sent: Fri, September 3, 2010 3:57:26 PM > Subject: [Haskell-beginners] Motivation to Learn Haskell > > Dear All, > It is my first post to this list and please do not take it as an attempt to > start any flamewar. >>From time to time, I try to find the motivation to learn at least the > fundamentals of another programming language. > I normally use R and Python on a daily basis (but I am not that much into OO > programming) and have a good knowledge of Fortran and a rather superficial > one > of C. > Beside learning a new language as a sort of mind expanding exercise, I try to > figure out how and if it can save me some time in my work and how it measures > up > against other languages. > These days I tend to rely on R for data analysis and visualization whereas I > use > Python (in particular Numpy+SciPy) for number crunching (it is very > convenient > to use scipy/numpy to solve ODE's, manipulate arrays and so on). > Now, I wonder what benefit I would gain from learning Haskell since I mainly > write codes for numerical simulations/data analysis. > I know Haskell is gaining momentum e.g. in the financial environment (I > happened > to see Haskell knowledge as a specification in some quant jobs) hence it must > be > more than suitable for numerical work and, by the little I have understood so > far, it allows one to write code really resembling mathematical expressions > (I > was impressed by guards and curried functions). > However, it also looks to me (correct me if I am mistaken) that Haskell is a > far > cry from the wealth of standard and contributed scientific modules you have > in > Python or R and thanks to which you do not re-implement the wheel yourself. > Any thoughts/suggestions are really appreciated. > Cheers > > Lorenzo > _______________________________________________ > Beginners mailing list > Beginners@haskell.org > http://www.haskell.org/mailman/listinfo/beginners > -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ ------------------------------ Message: 6 Date: Fri, 3 Sep 2010 22:51:59 -0400 From: Alec Benzer <alecben...@gmail.com> Subject: [Haskell-beginners] Real world example of Typeclasses > Interfaces To: beginners@haskell.org Message-ID: <aanlktikxuepy343twkn+76xxwyk1rs-yyfibx07fd...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Very new to Haskell, but I was just mulling this over; when I first learned about typeclasses, I saw the apparent benefit of being able to assert that a parameter to a function belongs to two typeclasses instead of just one. Ie, in Java, for example, you can ensure that a parameter to a function belongs to a particular interface by doing something like: int doSomething(Comparable c) { ... } But there's no real way of ensuring an argument implements two interfaces, whereas in Haskell you can make sure that an argument belongs to two (or however many) typeclasses. doSomething :: (Ord a, Eq a, OtherTypeClass a) => a -> Int ... But as I thought about this, I couldn't seem to think of a practical case where this would be useful. The basic typeclasses in Haskell seem to follow a hierarchy. Ie, anything that belongs to Ord belongs to Eq, anything that belongs to Enum belongs to Ord, anything that belongs to Num belongs to Enum. I suppose there may be certain cases involving Functors where there would be a point to specifying multiple typeclasses (eg, an Int would not work with (Functor a, Ord a)), but I guess I'm still somewhat skeptical about how often such a check would be necessary in practical applications. So I guess I'm just wondering if someone could give me an example of a practical case of the typeclass system allowing you to do a check like this that would not have been possible with interfaces. Or is there another benefit to typeclasses over interfaces that I've missed? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/beginners/attachments/20100903/1974cf49/attachment-0001.html ------------------------------ Message: 7 Date: Sat, 4 Sep 2010 00:52:15 -0400 From: Alec Benzer <alecben...@gmail.com> Subject: [Haskell-beginners] dealing with chained functions To: beginners@haskell.org Message-ID: <aanlktim4sge-3ukfy-yncohrashvuy+215s=mdos4...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Is there a generally accepted "better" way of dealing with the following: say I have three functions that all rely on output from each other. Ie, we get raw input, which one function processes. another function then requires the output from this function and produces some other output, which a third function then requires. would it be better to implement the functions like this: f1 :: a -> b f2 :: b -> c f3 :: c -> d final :: a -> d or like this: f1 :: a -> b f2 :: a -> c f3 :: a -> d Ie, in the latter set, f2 calls f1 on its input, and then proceeds to process it. f3 calls f2 on its input, etc. In the former case, final would just chain all three functions together itself (or I might just do it in main or somewhere else that's appropriate) Are one of these methods generally considered a better practice than the other, specifically in a functional context? My gut tells me that the former method looks more appropriate, but I'm not sure if it'd really be the accepted practice regardless of context, or if one might use either of these methods depending on the specifics of what they're doing. Or if it's just a matter of taste/opinion? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://www.haskell.org/pipermail/beginners/attachments/20100903/e00a6553/attachment.html ------------------------------ _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners End of Beginners Digest, Vol 27, Issue 9 ****************************************