[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sweeter Emacs Lisp
From: |
Stefan Monnier |
Subject: |
Re: Sweeter Emacs Lisp |
Date: |
Mon, 22 Jul 2013 11:24:13 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> + The *threading* macros "->" and "->>":
Feel free to contribute such macros. I probably wouldn't want to call
them "->" and "->>". The name should probably include "thread" or
"pipe". To make them useful, they should come with good edebug
support, which may turn out to be the more tricky part.
> + when-let, if-let:
As mentioned, `pcase' comes pretty close to `if-let', so I don't feel
a strong need for it. OTOH for when-let you'd need something like
(pcase <test>
(`(and (pred identity) ,<binding-form>) <body>))
which is uglier. So maybe a when-let makes sense, tho I'd prefer a when-let*
(which has also been seen under the name let-and, IIRC).
> + *we need a built-in core mapcan (could be called mapcat), filter and
> sequence concatenation (could be called cat?) function that doesn't
> depends on cl-lib*. This is fundamental stuff isn't it? Why is such a
> need to require a library for it?
The whole point of the big rename and partial rewrite of CL into cl-lib
was so that these functions can be used anywhere, thus making it
unnecessary to duplicate them into "core" Elisp.
> + Destructuring in defun and let: This looks weirder than I thought
> because of our (ab)use of parens everywhere, but I feel this is
> something brillant to have as part of the core language.
For destructuring let we have pcase-let. I have some tentative
pcase-lambda but haven't come up with something good enough yet.
I'm definitely open to suggestions here. As for including it directly
into "core" `defun', and `let', there are some technical issues (mostly
linked to bootstrapping and the performance cost especially in
interpreted code), but I do want to make pcase patterns more generally
available (e.g. making dolist work like pcase-dolist).
Stefan
- Re: Sweeter Emacs Lisp, (continued)
- Re: Sweeter Emacs Lisp, Miles Bader, 2013/07/15
- Re: Sweeter Emacs Lisp, Stephen J. Turnbull, 2013/07/16
- Re: Sweeter Emacs Lisp, Stefan Monnier, 2013/07/16
- Re: Sweeter Emacs Lisp, Juanma Barranquero, 2013/07/16
- Re: Sweeter Emacs Lisp, Andreas Schwab, 2013/07/16
- Re: Sweeter Emacs Lisp, Thierry Volpiatto, 2013/07/16
- Re: Sweeter Emacs Lisp, Juanma Barranquero, 2013/07/16
- Re: Sweeter Emacs Lisp, Andreas Schwab, 2013/07/16
- Re: Sweeter Emacs Lisp, Juanma Barranquero, 2013/07/16
- Re: Sweeter Emacs Lisp, Stefan Monnier, 2013/07/16
- Re: Sweeter Emacs Lisp,
Stefan Monnier <=