From: "Haris Bogdanović" Date: 2009-07-13T17:35:05+09:00 Subject: Re: one line sorting > Your sort method isn't really what most people would consider functional > programming, being that it relies on mutating the array (and the > each-method > which isn't even present in purely functional languages being that it > needs > side-effects to have any effect at all). Ok, but it does look elegant and in one line. That's how programs should look. 'The 'each' method can give me index of an element. I would use 'map' instead but it can't give me index, just the element so I would have to create a new list. I guess that would be pure functional and maybe more efficient in this case.. What are side-effects in this case ? > If you want to implement a sort method in functional style, you should > consider doing a recursive quick sort, which is quite simple and can be > done > in one line if you don't count the "def foo()" and "end" as their own > lines. > Also functional programming does not equal "one line". There's nothing > wrong > with spreading it out over multiple lines for readability. Just what I was going to try next.