emacs-devel
[Top][All Lists]
Advanced

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

Re: CL package serious deficiencies


From: Lars Ingebrigtsen
Subject: Re: CL package serious deficiencies
Date: Fri, 10 Feb 2012 16:24:55 +0100
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.0.93 (gnu/linux)

Stefan Monnier <address@hidden> writes:

> I've used incf occasionally, but don't find it terribly important.

I find it adds readability, since you don't have to see that
"(setq foo (1+ foo))" has the same `foo' both places.

>> `plusp'?
>
> Never used it.  (> n 0) is no shorter than (plusp n) and is just as
> clear, so I really don't see the benefit.

Again, I think it's usually more readable, because (as with `zerop')
it's immediately obvious what the condition is.  Especially with longer
parameters:

(plusp (1+ (foo-thing-that-computes-something)))

vs

(> (1+ (foo-thing-that-computes-something)) 0)

>> `delete-if-not'?
>
> That's the big one: some kind of "filter elements based on a predicate"
> is really handy and we definitely need to have this in core Elisp.
> OTOH I don't like the -if-not/-if duplication nor all the keyword
> arguments it takes, which just complicate significantly the
> implementation with very little benefit to the user/reader.

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.

>> `position'?
>
> I think having cl-position (after (require 'cl-lib)) is good enough for
> this one (it's handy and more readable than the Elisp replacement, but
> it's not used often).

Hey, are we listing all the CL functions that we find most useful?

`mapcan', `some', `every', `notany', `reduce', `remove-duplicates'...
Uhm...  I think that's it for me...  (In addition to the ones
mentioned.)

-- 
(domestic pets only, the antidote for overdose, milk.)
  http://lars.ingebrigtsen.no  *  Sent from my Rome



reply via email to

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