
Hi, I am a Haskell newbie. Having read some tutorials (Yet Another, Gentle Introduction) and some papers/tutorials on monads, I would like to spend some time practicing what I have learned before embarking on more abstract/obscure things and/or using Haskell for everyday tasks. I am looking for small to medium sized practice problems, preferably with solutions. Hal Daume's tutorial had some good one-liners (eg rewrite something point-free) but I am looking for something which would take 1-3 hours for a newbie, and then I could look at a solution by a Haskell expert and discover what I could have done better/more elegantly. Online references (or even book suggestions) would be appreciated. If you are teaching Haskell and have problems with confidential solution sets (some instructors like it that way), I can promise not to disclose the latter ;-) Thanks, Tamas

Hello Tamas, Sunday, September 3, 2006, 12:15:48 PM, you wrote:
I am looking for small to medium sized practice problems, preferably with solutions. Hal Daume's tutorial had some good one-liners (eg rewrite something point-free) but I am looking for something which would take 1-3 hours for a newbie, and then I could look at a solution
not exactly that you ask but i recommend you "hitchhikers guide" and "implementing Scheme in 48 hours" as an interesting mini-books for "advanced newbie". look at "books and tutorials" page i also suggest you to start write some library. there is enough useful libs that are still bnot implemented because lack of time (and insterest in such simple code) on side of more experienced programmers. i once proposed you to write strings library, another interesting and useful thing will be gzip/bzip2-lib bindings -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com

On Sun, Sep 03, 2006 at 12:47:45PM +0400, Bulat Ziganshin wrote:
Hello Tamas,
Sunday, September 3, 2006, 12:15:48 PM, you wrote:
I am looking for small to medium sized practice problems, preferably with solutions. Hal Daume's tutorial had some good one-liners (eg rewrite something point-free) but I am looking for something which would take 1-3 hours for a newbie, and then I could look at a solution
not exactly that you ask but i recommend you "hitchhikers guide" and "implementing Scheme in 48 hours" as an interesting mini-books for "advanced newbie". look at "books and tutorials" page
i also suggest you to start write some library. there is enough useful libs that are still bnot implemented because lack of time (and insterest in such simple code) on side of more experienced programmers. i once proposed you to write strings library, another interesting and useful thing will be gzip/bzip2-lib bindings
Bulat, I would be happy to write a strings library, I just don't know that it is supposed to do... (I have no CS education, only math/economics). If you show me the specifications or documentation in another language, I would write one as practice. Thanks, Tamas

Tamas K Papp wrote:
On Sun, Sep 03, 2006 at 12:47:45PM +0400, Bulat Ziganshin wrote:
i also suggest you to start write some library. there is enough useful libs that are still bnot implemented because lack of time (and insterest in such simple code) on side of more experienced programmers. i once proposed you to write strings library, another interesting and useful thing will be gzip/bzip2-lib bindings
Bulat,
I would be happy to write a strings library, I just don't know that it is supposed to do... (I have no CS education, only math/economics). If you show me the specifications or documentation in another language, I would write one as practice.
What about a library for interval arithmetic [1]? I'd imagine it could start something like: data Interval a = Interval !a !a deriving (Eq, Show) instance Num a => Num (Interval a) where Interval llow lhigh + Interval rlow rhigh = Interval (min llow rlow) (max lhigh rhigh) The Interval type would probably need to explicitly represent several kinds of intervals eg (-infinity, x] etc and there are some tricky issues about what to do with the operations whose result sometimes needs to be represented by more than one interval to be useful such as division by an interval containing zero eg you might want to use a list of intervals to deal with these cases: instance Num a => [Interval a] where ... ie [Interval 5 5] / [Interval -1 1] = [FromNegInfinityTo -5, ToPosInfinityFrom 5] though using a list may make things too slow (ideally it would be nice to have interval arithmetic that's as fast as normal floating point arithmetic - is this possible?) Alternatively, these cases could just be undefined though that might limit the usefulness of the lib. Another extremely useful thing would be a symbolic math library with a BSD (or LGPL) license... And yet another extremely useful thing would be a good library for numerical computations (there is GSLHaskell but that's licensed under GPL so there still seems to be a gap for something similar using LGPL or BSD). In general if you look at http://www.haskell.org/haskellwiki/Libraries_and_tools/Mathematics there appear to be many extremely useful libs already written, but unfortunately a lot of them are not BSD compatible so I think there is a huge gap for math related libs that people can use for commercial projects. Anyway just an idea :-), Brian. [1] http://en.wikipedia.org/wiki/Interval_arithmetic -- Logic empowers us and Love gives us purpose. Yet still phantoms restless for eras long past, congealed in the present in unthought forms, strive mightily unseen to destroy us. http://www.metamilk.com

On Sep 3, 2006, at 8:22 AM, Brian Hulley wrote:
Tamas K Papp wrote:
On Sun, Sep 03, 2006 at 12:47:45PM +0400, Bulat Ziganshin wrote:
i also suggest you to start write some library. there is enough useful libs that are still bnot implemented because lack of time (and insterest in such simple code) on side of more experienced programmers. i once proposed you to write strings library, another interesting and useful thing will be gzip/bzip2-lib bindings
Bulat,
I would be happy to write a strings library, I just don't know that it is supposed to do... (I have no CS education, only math/economics). If you show me the specifications or documentation in another language, I would write one as practice.
What about a library for interval arithmetic [1]?
I'll sign up to write this just as soon as I can control the floating- point rounding mode in purely functional code with low overhead. :-) Without this control, you end up with a toy which can't actually be used for real work. Sadly, I don't think GHC's built-in thread scheduler plays nicely with floating-point mode changes unless you do them across the entire program for the entire run. The interval multiplication algorithm turns out to be exciting. :-) -Jan-Willem Maessen

Tamas K Papp wrote:
I am looking for small to medium sized practice problems, preferably with solutions.
Hi Tamas, writing a Haskell library is very good idea yet requires some confidence. So for your first somehow useful programs, you could want to try olympiad / competition problems in Haskell. Of course, most are not specifically oriented towards Haskell as programming language and the harder ones are about tricky algorithms. But they are the kind of small yet intelligent task you are looking for. Not all have solutions but usually, google will reveal quite a few. The ultimate Haskell challenge is of course the ICFP contest http://icfpcontest.org/ There is also the International ACM Programming Contest http://acm.uva.es/problemset/ Your country surely has some kind of high school computing science competition to get problems from. Regards, apfelmus

On Mon, Sep 04, 2006 at 07:39:40PM +0200, apfelmus@quantentunnel.de wrote:
The ultimate Haskell challenge is of course the ICFP contest http://icfpcontest.org/ There is also the International ACM Programming Contest http://acm.uva.es/problemset/
I don't know about the services mentioned above, but Sphere Online Judge (http://www.spoj.pl/) allows you to submit solutions written in Haskell (and many other programming languages). Best regards Tomasz

Hi
I don't know about the services mentioned above, but Sphere Online Judge (http://www.spoj.pl/) allows you to submit solutions written in Haskell (and many other programming languages).
From that we can see Haskell is the 7th best programming langauge - and that number of problems solved is almost exactly the same as rank. I think perhaps we need a little project to conquer this benchmark
http://www.spoj.pl/ranks/languages/ like we did the gentoo/debian ones.... I'll have a go and scraping together some people for this, and starting up a wiki page tomorrow. Lots of little programs, no particular need for optimisation yet, so could be a great chance for beginners and the more experienced who'd just like a quick hack once in a while. As a general trend in that ranking list, it seems functional languages have fewer uses who have submitted more solutions. Perhaps this can be used to say something about the productivity of functional languages... Thanks Neil

On Mon, Sep 04, 2006 at 10:53:49PM +0100, Neil Mitchell wrote:
From that we can see Haskell is the 7th best programming langauge - and that number of problems solved is almost exactly the same as rank. I think perhaps we need a little project to conquer this benchmark like we did the gentoo/debian ones....
I'll have a go and scraping together some people for this, and starting up a wiki page tomorrow. Lots of little programs, no particular need for optimisation yet, so could be a great chance for beginners and the more experienced who'd just like a quick hack once in a while.
This, and especially publishing solutions on the Wiki, could be against the spirit of SPOJ. Here is a relevant piece from the FAQ: Q: the submitted programs, will they be made public here at some time ? or at least those, where the author agrees ? A: The problemset is persistent and some ranks are affected by number of solved problems. If the solutions are published it would be to easy to just copy the solution and submit it. Hence they will not be published. Authors are also requested not to publish their exact code. It is better and maybe more beneficial for everybody to discuss ideas and algorithms of solutions. The code is visible to admins and the problem setter of the task he stated. For some of the problems taken from competitions around the world it is probable that you may find a coded solutionon some other site. It is encouraged though that you understand the algorithm and code it yourself. This is rather a competition between people, not between languages. The rule of not publishing solutions can decrease the educational value of such service. But as they say, the problemset is persistent, the contests never ends. Many of those problems were taken from some olympiads and contests - those finish at some point, and then the solutions can be published. Best regards Tomasz

Hi
This, and especially publishing solutions on the Wiki, could be against the spirit of SPOJ. Here is a relevant piece from the FAQ:
I was going to put coordination information on the wiki - which problems don't have a Haskell solution etc - not actual solutions. If people have a particular problem getting a challenge to run inside the time limit, going on to #haskell and asking for advice is probably a good solution to learning things. Thanks Neil

On 9/5/06, Tomasz Zielonka
On Mon, Sep 04, 2006 at 07:39:40PM +0200, apfelmus@quantentunnel.de wrote:
The ultimate Haskell challenge is of course the ICFP contest http://icfpcontest.org/ There is also the International ACM Programming Contest http://acm.uva.es/problemset/
I don't know about the services mentioned above, but Sphere Online Judge (http://www.spoj.pl/) allows you to submit solutions written in Haskell (and many other programming languages).
As a Haskell newbie I've found the SPOJ challenges challenging, usually due to the time contraints placed on solutions. Another 'challenge site' I've enjoyed tremendously is Project Euler at http://mathschallenge.net/index.php?section=project Toby.

Toby Hutton wrote:
On 9/5/06, *Tomasz Zielonka*
mailto:tomasz.zielonka@gmail.com> wrote: On Mon, Sep 04, 2006 at 07:39:40PM +0200, apfelmus@quantentunnel.de mailto:apfelmus@quantentunnel.de wrote: > The ultimate Haskell challenge is of course the ICFP contest > http://icfpcontest.org/ > There is also the International ACM Programming Contest > http://acm.uva.es/problemset/
I don't know about the services mentioned above, but Sphere Online Judge (http://www.spoj.pl/) allows you to submit solutions written in Haskell (and many other programming languages).
As a Haskell newbie I've found the SPOJ challenges challenging, usually due to the time contraints placed on solutions.
Another 'challenge site' I've enjoyed tremendously is Project Euler at http://mathschallenge.net/index.php?section=project
Toby.
To coordinate submissions to sites like these, you should create a hierarchy on the new wiki [1] with the problems and haskell solutions, as was done on the old wiki for the shootout [2]. [1] http://haskell.org/haskellwiki/Example_code [2] http://haskell.org/hawiki/ShootoutEntry
participants (9)
-
apfelmus@quantentunnel.de
-
Brian Hulley
-
Bulat Ziganshin
-
Chris Kuklewicz
-
Jan-Willem Maessen
-
Neil Mitchell
-
Tamas K Papp
-
Toby Hutton
-
Tomasz Zielonka