Hacker News new | ask | show | jobs
by 1331 5479 days ago
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 _=[]
1 comments

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