Talk:Higher order function

From HaskellWiki
Revision as of 10:24, 10 November 2011 by Henk-Jan van Tuyl (talk | contribs) (Added an answer)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

I'm a beginner in Haskell and needs help I need a resourse of haskell from scratch and also need someone to explain in details the quicksort that is published:

quicksort :: Ord a => [a] -> [a]
quicksort []     = []
quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater)
        lesser  = filter (< p) xs
        greater = filter (>= p) xs

without line no 1, it works fine what about line three ? and how we use ++ as concatenate ???

Thanks in advance

You can better ask this sort of questions via the Haskell-beginners mailinglist or StackOverflow; the talk pages are usually used for discussion of a wikipage.

There are tutorials listed at

Line no. 1 is correct, it describes the type of the function.

xs ++ ys concatenates the lists xs and ys

You can find a description of how this function works at ; the function at this pages looks different, but is actually the same.

Henk-Jan van Tuyl 10:24, 10 November 2011 (UTC)