The first line reads: “When you sort an empty list ([]), the result is another empty list”. The second line reads: “To sort a list whose first element is named x and the rest of which is named xs, sort the elements of xs that are less than x, sort the elements of xs that are greater than or equal to x, and concatenate (++) the results, with x sandwiched in the middle.”

The code is so concise, yet clear (even with cryptic variable names like xs). The day my professor wrote it on the whiteboard was the first time I internalized that there might be something good about the alien world of functional programming.

The first one is a helper that takes two arguments, and sorts the first one into the second one using qsort/3.
The next line is a rough equivalent of saying that an empty list is sorted: the next argument is effectively an accumulator.
The final clause takes a non-empty list, and an already sorted accumulator, and sorts them. It partitions, and the recursively sorts the two halves.

(There’s also a naive version that appends sorted lists rather than using an accumulator, but that is not nearly as clever.)

This states that an empty list partitions into two empty lists.
The second clause states that we strip out any duplicates of the pivot.
The final two clauses actually partition the list.

Granted, this isn’t quite as nice as the Haskell version, but for me, having this (and the Scheme solution detailed above) really switched me onto FP. We had previously coded quicksort and mergesort in Java (and I had then done the same in C, and Python, just for good measure), and the pure beauty of the code here compared to the vulgar mess of Java made me a fan.