[Haskell-cafe] Re: excercise - a completely lazy sorting algorithm

Matthias Görgens matthias.goergens at googlemail.com
Thu Jul 9 02:20:55 EDT 2009

Interesting.  Can you make the definition of quicksort non-recursive,
too?  Perhaps with help of a bootstrapping combinator like the one
implicit in the approach I have given earlier?

> treeSort = bootstrap partitionOnMedian
> bootstrap f = Fix . helper . f
>     where helper = fmap (Fix . helper . f)

> partitionOnMedian :: forall a. (Ord a) => (S.Seq a) -> BTreeRaw a (S.Seq a)

Extra points if you can give 'bootstrap' or an equivalent in terms of
existing Haskell combinators.


More information about the Haskell-Cafe mailing list