emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Clojure-like syntactic sugar for an anonymous function liter


From: Stephen J. Turnbull
Subject: Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal
Date: Thu, 22 Jan 2015 19:15:12 +0900

Oleh writes:

 > 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.

Personally, I don't see a huge advantage to anonymous functions
anyway, not even in an interactive repl, and would surely spell it
either

    (defun square (x) (* x x))
    (mapcar #'square '(1 2 3))

or

    (labels ((square (x) (* x x)))
      (mapcar #'square '(1 2 3)))

in a library.  (Does Emacs have `labels'?  If not, `flet'.)  Tastes
vary, of course, but to me the existence of dash really looks like a
good argument for those with your tastes to use dash, not to add this
to Emacs.




reply via email to

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