emacs-devel
[Top][All Lists]
Advanced

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

RE: [External] : Re: cond* vs pcase


From: Drew Adams
Subject: RE: [External] : Re: cond* vs pcase
Date: Wed, 7 Feb 2024 17:09:26 +0000

> >>>    (pcase foo
> >>>      ('bar (do-some-bar-stuff))
> >>>      ('baz (do-some-baz-fluff)))
> >>> is not more awful or wonderful than:
> >>>    (cl-case foo
> >>>      (bar (do-some-bar-stuff))
> >>>      (baz (do-some-baz-fluff)))
> 
> Sorry to interject, but this really suggests
> that `cl-case' should become, simply, `case',
> in subr.el this time around...

Dunno if it suggests that, but yes, I've
argued that for a long time.  Emacs should
just adopt it as `case'.  (It _used to be_
just `case', BTW, but it was in `cl.el'.)

And it wouldn't hurt for Emacs to allow an
optional TEST arg for the equality predicate.

That also serves as the membership predicate,
i.e., for clauses such as this:

((foo bar toto) (handle-foo-bar-and-toto))

(An optional KEY arg isn't needed, since
`case' is simple - it uses the same part of
the input value for all clauses - just apply 
whatever KEY selector you need to the input 
sexp.  Another example of `case' simplicity.)

And adding optional TEST wouldn't bother 
any existing uses of `cl-case'.  `cl-case
could be aliased to the new `case' (or not).



reply via email to

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