Henry Ford, Innovation, and That "Faster Horse" Quote
blogs.hbr.org2 ポイント投稿者 l0stman0 コメント
split (left, right) x = if x<p then (x:left, right), else (left, x:right) qsort :: Ord a => [a] -> [a]
qsort [] = []
qsort (p:xs) = qsort lesser ++ [p] ++ qsort greater
where
lesser = filter (< p) xs
greater = filter (>= p) xs
I know nothing about Haskell but I don't think this code implements
the original quicksort algorithm which sorts the input in-place.
Moreover the two-pass of filter over the list and the concatenations
cause unnecessary overhead. Thus, even if the sample code is simple
and elegant, a real-world implementation would surely be a bit longer
than the given example. export GIT_PS1_SHOWDIRTYSTATE=yes
export GIT_PS1_SHOWUNTRACKEDFILES=yes mplayer mms://171.67.219.228/see/ainlpcs224n/cs224n-lecture01.wmv