Fun with fancy slicing

Alex Martelli aleax at aleax.it
Wed Oct 1 13:34:18 EDT 2003


Dave Benjamin wrote:
    ...
> of the trademark quicksort implementation in Haskell, ie. it may not be
> great in practice, but you can see the algorithm at a high level which
> makes it easier to figure out what's going on.

Hmmm, you mean as in...:

def quicksort(alist):
    head = alist[0]
    return quicksort([ x in alist[1:] if x<=head ]) + [
        head ] + quicksort([ x in alist[1:] if x>head ])

...?


Alex





More information about the Python-list mailing list