
Hi. I'm building website where people can try and "taste" new languages by solving small or mediums size tasks. Tasks are language specific and should show best features of the language. Website is not meant to teach new language but to give idea what is this language good for. Now I want to add Haskell. I need about 7-10 tasks for now. First three of four tasks are introductory, they should show/check basics of haskell. E.g. given n, return sum of squares of first n even numbers. Other tasks are more complicated and show advantages of functional programming in general or some specific haskell features. I don't have any experience with haskell and I need you help. Could you help me with ideas for tasks? Thank you, Nikita Beloglazov

sumOfSquares, sumOfSquares', sumOfSquares'' :: Int -> Int
sumOfSquares n = sum [x^2 | x <- [1..n]] -- list comprehensions
sumOfSquares' n = sum $ map (^2) [1..n] -- ($) for function application and explicit use of map
sumOfSquares'' = sum . map (^2) . enumFromTo 1 -- pointfree style
sumOfSquares''' :: Int -> (Int -> r) -> r
sumOfSquares''' n k = k . sum $ map (^2) [1..n] -- A very contrived bit of continuation passing style (k is the continuation)
I'll try to come up with more. I'm sure others on the list can come up with more varied stuff.
Jack Henahan
jhenahan@uvm.edu
==
Computer science is no more about computers than astronomy is about telescopes.
-- Michael R. Fellows
==
On Apr 16, 2012, at 12:46 PM, Nikita Beloglazov
Hi. I'm building website where people can try and "taste" new languages by solving small or mediums size tasks. Tasks are language specific and should show best features of the language. Website is not meant to teach new language but to give idea what is this language good for. Now I want to add Haskell. I need about 7-10 tasks for now. First three of four tasks are introductory, they should show/check basics of haskell. E.g. given n, return sum of squares of first n even numbers. Other tasks are more complicated and show advantages of functional programming in general or some specific haskell features. I don't have any experience with haskell and I need you help. Could you help me with ideas for tasks?
Thank you, Nikita Beloglazov _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On 16 April 2012 17:46, Nikita Beloglazov
Hi. I'm building website where people can try and "taste" new languages by solving small or mediums size tasks. Tasks are language specific and should show best features of the language. Website is not meant to teach new language but to give idea what is this language good for. Now I want to add Haskell. I need about 7-10 tasks for now. First three of four tasks are introductory, they should show/check basics of haskell. E.g. given n, return sum of squares of first n even numbers. Other tasks are more complicated and show advantages of functional programming in general or some specific haskell features.
I'd say that's the wrong criteria for a set of tasks and solutions. A better one would be to structure the list of tasks so that it teaches people what they need to know to write a fair range of programs in Haskell. This means working out what the main intellectual hurdles are in Haskell and structuring problems around them. So some "koans" as well as pieces designed to show "advantages",

I think that the idea is less to have a teaching tool, and more
to have a way to "shop around" for languages, by seeing what each
language is very good at.
Tom
On 4/18/12, umptious
On 16 April 2012 17:46, Nikita Beloglazov
wrote: Hi. I'm building website where people can try and "taste" new languages by solving small or mediums size tasks. Tasks are language specific and should show best features of the language. Website is not meant to teach new language but to give idea what is this language good for. Now I want to add Haskell. I need about 7-10 tasks for now. First three of four tasks are introductory, they should show/check basics of haskell. E.g. given n, return sum of squares of first n even numbers. Other tasks are more complicated and show advantages of functional programming in general or some specific haskell features.
I'd say that's the wrong criteria for a set of tasks and solutions. A better one would be to structure the list of tasks so that it teaches people what they need to know to write a fair range of programs in Haskell. This means working out what the main intellectual hurdles are in Haskell and structuring problems around them. So some "koans" as well as pieces designed to show "advantages",

On Wed, Apr 18, 2012 at 8:44 PM, Tom Murphy
wrote: I think that the idea is less to have a teaching tool, and more to have a way to "shop around" for languages, by seeing what each language is very good at.
Yes, Tom is right. Idea is to show what each language good for, to excite about it. It may be hard to achieve by solving tasks but I want to try. When user solves task he is be able to see author's solution. This way he can learn other (may be more beautiful) way to solve the task. Nikita

On 18 April 2012 21:08, Nikita Beloglazov
On Wed, Apr 18, 2012 at 8:44 PM, Tom Murphy
wrote: I think that the idea is less to have a teaching tool, and more to have a way to "shop around" for languages, by seeing what each language is very good at.
Yes, Tom is right. Idea is to show what each language good for, to excite about it.
Yes, I get that. It's a bad idea. Showing atypical "promotional" cases for each language encourages faddishness and silver bullet cults; it's irresponsible and unprofessional. If you're shopping around for a language then nothing is worse than selected sweet spot cases. Unless they are a fair-ish benchmark for a language that excels in a clear area, like R, APL and Awk and you're looking for a glorified DSL. I'd say that its better to have the same tasks for each language if you're evaluating a general purpose tool. Obvious ones would be, from simple to complex: - Some of the unix command line utilities like wc (some of these might be single liners) - OXO, Caesar cipher (10 lines or so) - The Markov chain program from the Practice Of Programming - Life - A simple spheres only ray tracer like the one in Graham's Lisp book - A simple calculator program like the one in Hutton - The recursive 2D shape program I've mentioned in other posts today - A version of the classic Traveller/Elite trading system - a really nice little toy business rules system that can be code either minimally or to show off the funkier features of a language to get more flexibility and more interesting pricing rules. Minimal version would be a few tens of lines and the config file declaring items. If you want to see a language comparison done responsibly, look at Kernighan and Pike's "Practice Of Programming."
participants (4)
-
Jack Henahan
-
Nikita Beloglazov
-
Tom Murphy
-
umptious