emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs lisp syntax rfc: (cond (EXPR => (lambda (X) ...)))


From: Stephen J. Turnbull
Subject: Re: emacs lisp syntax rfc: (cond (EXPR => (lambda (X) ...)))
Date: Wed, 05 Jan 2011 10:55:28 +0900

Thien-Thi Nguyen writes:

 > - We are already dealing with a construct where the
 >   treatment of the list is non-uniform (EXPR vs BODY),
 >   so playing in the "neck" area has precedence: special
 >   handling of docstring, ‘interactive’ form, indentation
 >   hints (for ‘defmacro’), etc.

All these occur in a top-level form, though.

 > - Functional style is not unlispy.

True, but in the examples so far you could define a macro like

(defmacro applificating-cond (&rest clauses)
  "Documentation is all too often left to the reader.
This docstring just follows that custom."
  (let ((var (gensym)))
    `(let (,var)
       (cond ,@(mapcar (lambda (clause) `((setq ,var ,(car clause))
                                          (funcall ,(cdr clause) ,var)))
                       clauses)))))

and write

   (applificating-cond 
     ((cdr list) #'car)
     ((car list) #'car)

instead of

 >   (cond 
 >     ((cdr list) => #'car)
 >     ((car list) => #'car)

No?

 > No variables at all!

I do like that.  So, do you ever want to write

   (cond 
     ((cdr list) => #'car)
     ((car list) (random-expr-not-needing-value-of-car-list free-var))

or the like?  (That makes me feel a little ill, but YMMV.)



reply via email to

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