[Top][All Lists]

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

Re: Adding assoc-delete-all / rassoc-delete-all

From: Tassilo Horn
Subject: Re: Adding assoc-delete-all / rassoc-delete-all
Date: Thu, 17 Apr 2014 14:35:27 +0200
User-agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.4.50 (gnu/linux)

Thorsten Jolitz <address@hidden> writes:

> Reminds me of the many times I wished there would be a
> ,--------------------------------------------------------
> | case is an alias for `cl-case' in `cl.el'.
> | 
> | (case EXPR (KEYLIST BODY...)...)
> | 
> | Eval EXPR and choose among clauses on that value. [...]
> | Key values are compared by `eql'.
> `--------------------------------------------------------

Strange that it compares with `eql'.  Doesn't `eql' only allow comparing
floating point values in addition to what's allowed by `eq'?  And floats
don't seem to be reasonable candidates for a `case' distinction...

> that does comparison with `equal' too (or does it exist and I just
> missed it?).

No, I don't think there is.  But I think here a more versatile macro
would be better than hard-coding another version with the test fixed to
`equal' [1].  For example, Clojure has `condp' which is similar to
`case' but allows to specify the predicate.

  (condp #'equal x
    "Foo"    :foo
    1        :one
    17       :seventeen


[1] That's a bit different for `assoc-delete-all' because the names
    `assq' and `assoc' are traditionally associated with `eq' and

reply via email to

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