[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Clojure-like syntactic sugar for an anonymous function liter
From: |
Oleh |
Subject: |
Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal |
Date: |
Thu, 22 Jan 2015 11:22:42 +0100 |
> > The most popular library in MELPA, https://github.com/magnars/dash.el,
> > implements it (for a long time) like this:
> >
> > (--map (* it it) '(1 2 3))
> > ;; => (1 4 9)
> >
> > With my approach, it's:
> >
> > (mapcar #(* % %) '(1 2 3))
> > ;; => (1 4 9)
>
> That looks almost like Perl! Now I'm -2. Just require dash.
How is `dash' better? `--map' is a macro:
(defmacro --map (form list)
"Anaphoric form of `-map'."
(declare (debug (form form)))
`(mapcar (lambda (it) ,form) ,list))
`dash' also gives other ~40 macros that look like this, littered all
over the code in the MELPA, so it's impossible to go on without
understanding what `dash' does.
On the other hand, `mapcar' is a C function. It and all other
functions can use `short-lambda' instead of being reimplemented as
macros on a case-per-case basis by `dash'.
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, (continued)
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Leo Liu, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Stephen J. Turnbull, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, David Kastrup, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Stephen J. Turnbull, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Oleh, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Stephen J. Turnbull, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal,
Oleh <=
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, David Kastrup, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Oleh, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Tassilo Horn, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Oleh, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Stephen J. Turnbull, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Oleh, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Stephen J. Turnbull, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Artur Malabarba, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Stephen J. Turnbull, 2015/01/22
- Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal, Phillip Lord, 2015/01/22