3 ms·
Yet another article that completely misses the point. The point of "Hello World" is to show a noob how to fire up the editor, compile, and see something happen.
by DanielBMarkham 16y ago
Yet another article that completely misses the point. The point of "Hello World" is to show a noob how to fire up the editor, compile, and see something happen.
And btw, here's the answer in F#:
let rec qsort = function
| [] -> []
| x::xs -> let smaller,larger = List.partition (fun y -> y<=x) xs
qsort smaller @ [x] @ qsort larger
- sizzla 16y agoThis looks like yet another Haskell "variant." From what I can tell this sort does not occur in place and thus would not make a particularly good quicksort. Memory use, number of accesses per element, etc. This style of programming is more suitable for heapsort or maybe mergesort.
- zbanks 16y agoYou can't exactly sort "in place" in functional languages like F#/Haskell... at least trivially.
- fleitz 16y agoGiven the level of abstraction in most modern programing languages/ operating systems it's really hard to say that any modern language could implement quicksort in the most strict definitions. For example, is a quicksort 'in-place' if your memory gets swapped to disk?