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: Ivan Andrus
Subject: Re: [PATCH] Clojure-like syntactic sugar for an anonymous function literal
Date: Thu, 22 Jan 2015 09:57:09 -0700

On Jan 22, 2015, at 3:05 AM, Oleh <address@hidden> wrote:

Sure. My point is that existence of prettify-symbols-mode and equivalent
is another argument against the creation of a shorter-than-lambda
function literal syntax.

Note that this isn't just a lame

  (defalias 'λ 'lambda)

we're talking about here. `short-lambda' takes away a *whole* paren
nesting level, which can be a lot, when there's only two (and there
usually is).

FWIW, if you change short-lambda to be

(defmacro short-lambda (&rest structure)
 ...)

then short-lambda can get rid of the extra level of parens.  Though I have to admit that

#(+ % %)

is probably easier to read than

(λ + % %)

I’m personally slightly in favor of this feature (and more in favor of reader macros).  But everything we add to Emacs lisp is something must also be added to Guile before we can get EmacsGuile which I would also like. :)

I have my own interactive-lambda macro that creates interactive lambdas for use in keybindings and such.  It seems that making the lambdas interactive is a very important feature for the use cases I have for lambdas in Emacs.  I also have an (inaccurately named) add-lambda-to-hook macro that creates a _named_ function and adds it to a hook.  This prevents it from being double added and allows updating the "lambda".  IOW I'm not sure a single mechanism can handle all use cases satisfactorily.

-Ivan

reply via email to

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