Re: qsort optimized for brevity




<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


.



Relevant Pages

  • Re: qsort optimized for brevity
    ... > The eval will be really slow and the evaluation of max will crash if list is too big. ... Marc ... Prev by Date: ...
    (comp.lang.lisp)
  • Default Date Problem
    ... MSACESS.EXE crashes. ... that the old field was corrupted somehow) and to the form, ... with its Datecauses a crash. ... Prev by Date: ...
    (microsoft.public.access.forms)
  • Re: ZX10R
    ... immaculate K1 stuff that Hog fitted after his crash. ... Lozzo ... Prev by Date: ...
    (uk.rec.motorcycles)
  • Re: (i++ * i++)
    ... :>: crash. ... It should generate no overhead but simply allow conforming ... :> implementations to assume that i1 and i2 are distinct objects. ... Otherwise the behavior resulting from that evaluation is "undefined", ...
    (comp.lang.cpp)
  • Re: Attachments
    ... "Brambles" wrote in message ... > I have the same problem.I print for our office records, ... evaluation and in the event of a crash or virus. ...
    (microsoft.public.outlook)