
Hey everyone
I'm new on the list here and just started out learning Haskell and
functional programming. I have over 12 years experience programming in
various languages, from C to Python.
I started out with the Why Haskell matters paper (
http://haskell.org/haskellwiki/Why_Haskell_Matters) and ran into a problem
with the code below. It's discussed in the paper but when I save it to
test.hs and load it into ghci, I get the following output:
------------------------
[1 of 1] Compiling Main ( test.hs, interpreted )
test.hs:6:22: parse error on input `='
Failed, modules loaded: none.
------------------------
Could someone give a pointer on where my error lies?
qsort [] = []
qsort (x:xs) = qsort less ++ [x] ++ qsort more
where less = filter (

Hi Michael, Is line 6 the " more = filter (>= x) xs" line? Try lining up the word 'more' with the word 'less' above it - and if you can't seem to get it to work, try making sure you're using all spaces and not tabs to indent! HTH, Arlen On Thu, 2011-03-10 at 08:46 +0100, Michael Anckaert wrote:
Hey everyone
I'm new on the list here and just started out learning Haskell and functional programming. I have over 12 years experience programming in various languages, from C to Python.
I started out with the Why Haskell matters paper (http://haskell.org/haskellwiki/Why_Haskell_Matters) and ran into a problem with the code below. It's discussed in the paper but when I save it to test.hs and load it into ghci, I get the following output:
------------------------ [1 of 1] Compiling Main ( test.hs, interpreted )
test.hs:6:22: parse error on input `=' Failed, modules loaded: none.
------------------------
Could someone give a pointer on where my error lies?
qsort [] = [] qsort (x:xs) = qsort less ++ [x] ++ qsort more where less = filter (
=x) xs -- Kind regards Michael Anckaert
http://www.sinax.be _______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Good morning,
Take a look at the following - it comes from Graham Hutton's book: "Programming in Haskell" - see link: http://horna.org.ua/books/fp-papers/Hutton,%20Graham%20-%20Programming%20in%...
qsort :: (Ord a) => [a] -> [a]
qsort [] = []
qsort (x:xs) = qsort smaller ++ [x] ++ qsort larger
where
smaller = [a|a<-xs, a <= x]
larger = [a|a<-xs, a > x]
----- Original Message -----
From: Michael Anckaert
To: beginners@haskell.org
Sent: Thursday, March 10, 2011 2:46 AM
Subject: [Haskell-beginners] Beginners issue with 'Why Haskell matters' example code
Hey everyone
I'm new on the list here and just started out learning Haskell and functional programming. I have over 12 years experience programming in various languages, from C to Python.
I started out with the Why Haskell matters paper (http://haskell.org/haskellwiki/Why_Haskell_Matters) and ran into a problem with the code below. It's discussed in the paper but when I save it to test.hs and load it into ghci, I get the following output:
------------------------
[1 of 1] Compiling Main ( test.hs, interpreted )
test.hs:6:22: parse error on input `='
Failed, modules loaded: none.
------------------------
Could someone give a pointer on where my error lies?
qsort [] = []
qsort (x:xs) = qsort less ++ [x] ++ qsort more
where less = filter (
participants (3)
-
Arlen Cuss
-
Michael Anckaert
-
Patrick Lynch