Re: qsort optimized for brevity
- From: "Marc Battyani" <Marc.Battyani@xxxxxxxxxxxxxxxxxx>
- Date: Wed, 21 Dec 2005 23:35:40 +0100
<nallen05@xxxxxxxxx> wrote
> noone said it had to be fast right? ; - )
>
> (defun qsort (list &optional 2nd)
> (if (null list)
> 2nd
> (let ((max (eval (cons 'max list))))
The eval will be really slow and the evaluation of max will crash if list is too big.
You should use (reduce 'max list) instead.
But don't worry it will be slow enough anyway ;-)
> (qsort (remove max list :count 1) (cons max 2nd)))))
Marc
.
- Follow-Ups:
- Re: qsort optimized for brevity
- From: Marc Battyani
- Re: qsort optimized for brevity
- References:
- qsort optimized for brevity
- From: justinhj
- Re: qsort optimized for brevity
- From: Greg Buchholz
- Re: qsort optimized for brevity
- From: Bruce Hoult
- Re: qsort optimized for brevity
- From: nallen05
- qsort optimized for brevity
- Prev by Date: Re: qsort optimized for brevity
- Next by Date: Re: Do I have to be an expert to get performance: CL versus Perl
- Previous by thread: Re: qsort optimized for brevity
- Next by thread: Re: qsort optimized for brevity
- Index(es):
Relevant Pages
|