karlheg(a)inetarena.com (Karl M. Hegbloom) writes:
In pcl-cvs.el:1604
((eq (car (car parse-spec)) 'COLLECT)
(setq *result* (cons (eval (car (cdr (car parse-spec))))
*result*)))
((eq (car (car parse-spec)) 'PROG)
(eval (car (cdr (car parse-spec)))))
((eq (car (car parse-spec)) 'REGEXP)
(cond
;; Is it a match? (The regexp must be anchored at the end of a line).
((and (looking-at (car (cdr (car parse-spec))))
(progn (goto-char (match-end 0))
(eolp)))
[...]
Is there any reason I should *not* change things like this to read:
Yes, I'll name one good reason: you should try not to change code that
it not actively maintained by the XEmacs team without a good reason.
Changing (car (car foo)) to (caar foo) is not a good reason.
Another question that comes to mind is "Why aren't the cXr
accessors subrs?" It seems like that would be way faster, and
there may be code that would benefit from it.
No, it would actually be slower. `car' has its own byte-code, while a
new `caar' subr would have to be invoked through the normal means of
`funcall', ending up much slower than double BCAR. Witness the joys
of Emacs Lisp!
Is there any advantage in converting (function (lambda () ...)) to
#'(lambda () ...) other than for readability?
No. The forms are entirely equivalent, both in Common Lisp and in
Emacs Lisp. In fact, the latter is silently converted to former at
read-time.
Or `((, var) ...) to #`(,var ...)?
You mean `(,var ...), right? Besides the obvious readability
improvement, you might count as an advantage that the new-style
backquotes are compatible with Common Lisp. But these reasons do not
warrant for changing code not maintained by us.
When you write new code, however, feel free to use
caar/#'(lambda ...)/new-style-backquotes/etc.
--
Hrvoje Niksic <hniksic(a)srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
The meta-Turing test counts a thing as intelligent if it seeks to
devise and apply Turing tests to objects of its own creation.