[Haskell-beginners] A Comparison of Haskell and Scheme

Benjamin L.Russell DekuDekuplex at Yahoo.com
Tue Feb 10 02:18:45 EST 2009

Although somewhat dated (posted on October 24, 2006 4:39 PM, to be
precise), here is an interesting comparison of Haskell and Scheme, by
Mark C. Chu-Carroll, a PhD computer scientist who works as a software
engineer at Google, on his blog, regarding whether someone should
translate Douglas Hofstadter's columns introducing Scheme to replace
the Scheme code with Haskell code:

Good Math, Bad Math : Haskell and Scheme: Which One and Why?

The entry discusses differences in syntax, typing, and semantics, and
makes for interesting reading.  Surprisingly, he states that Haskell
syntax is easier to learn for beginners:

>I've actually taught an introduction to computer class using Scheme, 
>and the syntax was a big problem.
>I think that syntactically, Haskell is a better language for beginners. 
>Haskell syntax is very redundant, which is good for people. Compare 
>these two little snippets:
>(define (fact n)
>    (if (= n 0)
>        1
>        (* n (fact (- n 1)))))
>fact n = if n == 0
>        then 1
>        else n * fact(n-1)
>Which is easier to read? And the Haskell can get even easier to read 
>and write using pattern matching:
>fact 0 = 1
>fact n = n * fact (n-1)
>Try this comparison:
>(define (fold init reducer list)
>    (if (eq? list ())
>        init
>        (reducer (car list) (fold init reducer (cdr list)))))
>fold init reducer [] = init
>fold init reducer l:ls =  reducer l (fold init reducer ls)
>The difference gets much more obvious with bigger pieces of code. 
>Between the deliberate redundancies in Haskell's syntax, and the way 
>that pattern matching lets you decompose programs, the Haskell is 
>significantly clearer.

This is the first time that I have seen a claim that Scheme syntax was
a big problem compared to Haskell syntax, but his claims make sense.
It makes me wonder whether his students were true beginners....

If his claims are true, though, then we probably need a counterpart to
SICP (see http://mitpress.mit.edu/sicp/) for Haskell.  The closest I
can think of is SOE (see http://www.haskell.org/soe/); any
alternatives?  There's also _The Haskell Road to Logic, Maths and
Programming_ (see http://homepages.cwi.nl/~jve/HR/) and _Real World
Haskell_ (see http://book.realworldhaskell.org/), but the former is
really about using Haskell to learn discrete mathematics and logic,
and the latter is not directed toward computer science majors, so they
don't correspond very closely.  If Haskell is well-suited as a
language for beginners, then there shouldn't be any reason for not
creating a Haskell alternative.

-- Benjamin L. Russell
Benjamin L. Russell  /   DekuDekuplex at Yahoo dot com
Translator/Interpreter / Mobile:  +011 81 80-3603-6725
"Furuike ya, kawazu tobikomu mizu no oto." 
-- Matsuo Basho^ 

More information about the Beginners mailing list