On Mon, 2013-08-26 at 00:57 +0200, Joseph Rushton Wakeling wrote: > On 24/08/13 19:01, Ramon wrote: > > I think that there is a lot speaking against sloc. > > > > First it's often (ab?)used for "Ha! My language x is better than yours. I > > can > > write a web server in 3 lines, you need 30". > > Don't know about a web server, but I remember somewhere online I found this > really cool 3-line quicksort that you can do in Haskell :-) > > qsort [] = [] > qsort (x:xs) = qsort (filter (< x) xs) ++ [x] > ++ qsort (filter (>= x) xs)
OK so good for the first 20s of a lecture on Quicksort and totally useless for doing anything properly. Two main reasons: 1. It copies data rather than doing it in situ, should use Mergesort. 2. passes over the data twice instead of once. This is a perfect example of where minimizing LOC and doing the right thing are opposed. -- Russel. ============================================================================= Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected] 41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected] London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
