emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CL package serious deficiencies


From: Johan Bockgård
Subject: Re: CL package serious deficiencies
Date: Fri, 10 Feb 2012 19:47:24 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> I think the `-if' and `-if-not' help with reading comprehension, because
>> you're signalling in the function name what you mean to do, and you
>> don't have to read the predicate as thoroughly.  And the predicate can
>> be written clearer, too.  If you don't have both forms, the predicate
>> often tends to look like `(lambda (foo) (not ...))', which makes my
>> brain hurt.
>
> That's just a question of habit, really.
>
> [ You might prefer "delete-if (¬ ∘ pred) list", of course.  ]

AKA `complement' in Common Lisp:

--8<---------------cut here---------------start------------->8---

      (complement x) == #'(lambda (&rest arguments) (not (apply x arguments)))

In Common Lisp, functions with names like "xxx-if-not" are related to
functions with names like "xxx-if" in that

     (xxx-if-not f . arguments) == (xxx-if (complement f) . arguments)

For example,

      (find-if-not #'zerop '(0 0 3)) ==
      (find-if (complement #'zerop) '(0 0 3)) =>  3

--8<---------------cut here---------------end--------------->8---



reply via email to

[Prev in Thread] Current Thread [Next in Thread]