One line sorting

Ok, but it does look elegant and in one line.
That’s how programs should look.

I beg to disagree… That’s definitely not what MY programs look like
and they hopefully never will. Just because it’s in one line, it’s not
Readability is a big issue when developing “good” software.
After all, you want to be able to understand what you did, even
some months or years after you wrote the code. Putting everything
in one line doesn’t help there very much in my experience.


On Jul 13, 5:47 am, “Haris Bogdanoviæ” [email protected] wrote:

def quick_sort(array)
return array if array.length <=1
return quick_sort( {|i| i<pivot}) + {|i|
i==pivot} + quick_sort( {|i| i>pivot})

Why not use:

quick_sort( {|i| i<=pivot}) + quick_sort( {|i|

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs