[cdr-discuss] lessp, etc.

Matthew D. Swank akopa.gmane.poster at gmail.com
Sun Feb 27 21:29:56 UTC 2011


Though a less conservative addition than aequalis/compare, you could
also provide:

Standard Generic Function COMPARE-OP
Syntax:
COMPARE-OP op a b &optional recursive-p
&rest keys &key &allow-other-keys ⇒ generalized-boolean

Default methods specialized on (op (eql '<)), (op (eql '>)), and (op
(eql '=))
could delegate to compare. Lessp, and friends could delegate to
compare-op, and a no-applicable-method would indicate values are
incomparable.


Matt

On 02/27/2011 12:19 PM, Matthew D. Swank wrote:
> The idiom is usually use to implement comparable types is to provide
> lessp (and aequalis if need be), so I am not as familiar with using the
> compare operator.  However, my concern is that making lessp and friends
> regular functions would not allow users to provide optimized versions of
> those functions as specialized methods.  Is a good implementation of
> compare fast enough?
>
> Matt
>





More information about the cdr-discuss mailing list