Difference between revisions of "Talk:Higher order function"

From HaskellWiki
Jump to navigation Jump to search
(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] -...)
 
Line 1: Line 1:
 
I'm a beginner in Haskell and needs help
 
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:
 
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 :: Ord a => [a] -> [a]
Line 8: Line 12:
 
lesser = filter (< p) xs
 
lesser = filter (< p) xs
 
greater = filter (>= p) xs
 
greater = filter (>= p) xs
  +
  +
----
  +
   
 
without line no 1, it works fine
 
without line no 1, it works fine

Revision as of 03:00, 8 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