[alexandria-devel] EXTREMUM

Tobias C Rittweiler tcr at freebits.de
Wed Apr 25 14:21:48 UTC 2012


In article 
<CADow0CrM=mrumUUTe11ZxgT594Sz41PApPYg--y+SBb8jzqOXQ at mail.gmail.com>,
 Nikodemus Siivola <nikodemus at random-state.net> wrote:

> On 25 April 2012 15:30, Nikodemus Siivola <nikodemus at random-state.net> wrote:
> 
> >> CL-UTILITIES calls this function EXTREMUM. (It also provides a couple
> >> of more functions along the lines to cover some edge cases.)
> >
> > Pushed a version. Can you verify that it is what you wanted, and
> > performs acceptably?
> 
> So, what about the NO-EXTREMUM thing?
> 
> I think it's good that the behaviour specified, instead of depending
> on the PREDICATE and REDUCE, but an an interface NO-EXTREMUM +
> CONTINUE is terrible: unless you handle the error right around the
> call site, it's pointless, since no-one higher up the call stack can
> know for sure where the error came from. At the call site it is overly
> verbose and inefficient:
> 
>  (handler-bind ((no-extremum #'continue))
>     (extremum ...))
> 
> I would much like to remove mention of the restart from the docstring,
> and add &KEY DEFAULT instead:
> 
>     (extremum ... :default nil)
> 
> would provide the same behaviour as invoking CONTINUE. Since you
> obviously actually use this thing, any comments?

I agree it's pointless. Why not just return NIL? (Or possibly
(values <element> T) in case an extremum was found.)
FIND, FIND-IF just return NIL, too, never minding the ambiguity.
And EXTREMUM can be thought of a special case of FIND.

T





More information about the alexandria-devel mailing list