Shortest Quicksort Ever?
taliesinb.net
taliesinb.net
quicksort =: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#)
http://stackoverflow.com/questions/2603739/what-is-the-most-...And so, I beging to lose another two hours of my life as I attempt to understand what this interesting syntax mechanism for representing algorithms consists of...
qsort :: (Ord a Bool) => [a] -> [a]
qsort [] = []
qsort (x:xs) = qsort (filter (<= x) xs) ++ [x] ++ qsort (filter (> x) xs)
Not 61 characters, but it has the added benefit of being comprehensible!
f=filter
q[]=[]
q(h:t)= q(f(<=h)t)++[h]++q(f(>h)t f=filter
q(h:t)=q(f(<=h)t)++h:q(f(>h)t)
q _=[] f=filter
q(h:t)= q(f(<=h)t)++h:q(f(>h)t)
q a=a