This seems to be the Haskell equivalent

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Dec 21 19:12:10 PST 2009


Tim Matthews wrote:
> On 21/12/2009 8:57 p.m., Don wrote:
>> retard wrote:
>>> Sun, 20 Dec 2009 16:44:03 +0100, Don wrote:
>>>
>>>> downs wrote:
>>>>> according to
>>>>> http://www.mail-archive.com/haskell-cafe%40haskell.org/msg63381.html
>>>>>
>>>>> I'll let this speak for itself.
>>>>>
>>>>> import Data.Array.Base (unsafeRead, unsafeWrite)
>>>> [snip]
>>>>
>>>> Brilliant.
>>>
>>> What is so brilliant? Referential transparency is broken unless single-
>>> threadedness is forced through monadic computation or by some other
>>> means (uniqueness types comes to mind).
>>
>> The brilliant bit is the idea of doing a fairer comparison of quicksort
>> between D and Haskell.
> 
> 
> Quicksort can be expressed in haskell just like this:
> 
> qsort []     = []
> qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ qsort (filter (>= x) xs)
> 
> 
> It probably performs like a bitch but is a very beautiful way to express 
> quicksort.

That definition is what was discussed in this thread and alleged to be 
anything but beautiful.

Andrei



More information about the Digitalmars-d mailing list