# Talk:Higher order function

### From HaskellWiki

Yasmin.Fathy (Talk | contribs) (New page: 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] -...) |
(Added an answer) |
||

(One intermediate revision by one user not shown) | |||

Line 2: | Line 2: | ||

I need a resourse of haskell from scratch and also need someone to explain in details the quicksort that is published: | 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) | + | ---- |

− | + | ||

− | + | quicksort :: Ord a => [a] -> [a] | |

− | + | quicksort [] = [] | |

+ | quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater) | ||

+ | where | ||

+ | lesser = filter (< p) xs | ||

+ | greater = filter (>= p) xs | ||

+ | |||

+ | ---- | ||

+ | |||

without line no 1, it works fine | without line no 1, it works fine | ||

Line 13: | Line 20: | ||

Thanks in advance | Thanks in advance | ||

+ | |||

+ | ---- | ||

+ | |||

+ | You can better ask this sort of questions via the [http://haskell.org/mailman/listinfo/beginners Haskell-beginners mailinglist] or [http://stackoverflow.com/ StackOverflow]; the talk pages are usually used for discussion of a wikipage. | ||

+ | |||

+ | There are tutorials listed at http://www.haskell.org/haskellwiki/Tutorials | ||

+ | |||

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

+ | |||

+ | <hask>xs ++ ys</hask> concatenates the lists <hask>xs</hask> and <hask>ys</hask> | ||

+ | |||

+ | You can find a description of how this function works at http://learnyouahaskell.com/recursion ; the function at this pages looks different, but is actually the same. | ||

+ | |||

+ | |||

+ | [[User:Henk-Jan van Tuyl|Henk-Jan van Tuyl]] 10:24, 10 November 2011 (UTC) |

## Latest revision as of 10:24, 10 November 2011

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) where 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 http://www.haskell.org/haskellwiki/Tutorials

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

You can find a description of how this function works at http://learnyouahaskell.com/recursion ; the function at this pages looks different, but is actually the same.

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