News for hackers. Stuff that matters.
Re:Shortest Quicksort Ever? by scarmig on Monday June 13, 2011 @12:41AM (#2648158)
This is a good opportunity to show off the (fake) Haskell quicksort:

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!

Re:Shortest Quicksort Ever? by chamakits on Monday June 13, 2011 @01:08AM (#2648196)
Saw your code, couldn't believe how awesome it was, and made an effort to make it shorter just for kicks. (Warning though, I'm pretty new to Haskell.) Did a bit of "cheating" here and there, since the purpose is for it to be as concise as possible, and got it to 50 characters. I'm sure someone can get it lower :P

   f=filter
   q[]=[]
   q(h:t)= q(f(<=h)t)++[h]++q(f(>h)t
Re:Shortest Quicksort Ever? by 1331 on Monday June 13, 2011 @02:07AM (#2648282)
I got it down to 47 characters and improved the performance by moving the less common case to the bottom. (Not that is matters since this implementation sacrifices performance for elegance, but playing code golf with Haskell destroys the elegance anyway...)

  f=filter
  q(h:t)=q(f(<=h)t)++h:q(f(>h)t)
  q _=[]
Re:Shortest Quicksort Ever? by chamakits on Wednesday June 15, 2011 @01:52AM (#2656130)
totally stole your idea and found a way to do it in 46 characters :P

   f=filter
   q(h:t)= q(f(<=h)t)++h:q(f(>h)t)
   q a=a