[Top][All Lists]

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

moving more cl seq/mapping support into core

Subject: moving more cl seq/mapping support into core
Date: Fri, 24 Sep 2010 18:48:26 -0400

| :FROM:                      Chong Yidong
| :SUBJECT:                   Re: Problems with xml-parse-string
| :DATE:                      Fri, 24 Sep 2010 12:26:21 -0400
| It is illogical to criticize sxml for wasting conses, while arguing for
| wrapping each text node in a cons.
| Anyway, it is difficult to see how real the problem is without a
| concrete example.  Could you provide one?  I suspect that the real
| problem, if one exists, is Elisp's relatively weak support for list
| mapping and reduction; if that's the case, the correct solution is to
| pull in some of the relevant functions from the CL package.
| (URL `http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01250.html')

| :FROM    RMS
| :SUBJECT Re: Emacs Package Management
| :DATE    Tue, 15 Sep 2009 03:16:50 -0400
|     Could we then privide aliases like "cl-loop" for "loop" ?
| I am not against it.
|     Maybe we could include Cl functions in the Emacs core
|     incrementaly then?  Each CL function moved to the core would
|     require an agreement on the functions inclusion and a
|     documentation patch.
| That's more or less what we've been doing.  Originally I strove very
| hard to keep Emacs itself small.  Many basic and obviously useful
| functions were not standardly available, but they were in CL. Since
| then we have made a number of them standard, and we could certainly
| do this for more of them in the future when it seems best.
| But some of the CL facilities are overly complex.  And some,
| specifically setf and friends, are not implemented quite right in
| the Emacs context, which makes them ugly to include.
| {...}
| :SEE (URL 

Following is a list of symbols in other packages wich cl.el provides and which
are duplicated either verbatim or indirectly to achieve the same affect
and presumably to avoid cl.el runtime package requirements.
These are without the `&keys` lambda-lists but some provide predicate
type arguments to accomplish similiarly to :test

`edmacro-subseq'            <- `subseq' emacs-lisp/cl-extra.el
`smtpmail-intersection'     <- `intersection' emacs-lisp/cl-seq.el
`dired-file-set-difference' <- `set-difference'  lisp/dired-aux.el

`edebug-gensym-index' <- `*gensym-counter*' emacs-lisp/cl-macs.el
`edebug-gensym'       <- `gensym'  emacs-lisp/cl-macs.el

`edebug-lambda-list-keywordp' could be improved by changing from:

  (and (symbolp object)
       (= ?& (aref (symbol-name object) 0)))

 (and (memq object lambda-list-keywords) t)

 (and (memq '&aux lambda-list-keywords) t)

`lambda-list-keywords' is a constant in emacs-lisp/cl-macs.el

`erc-member-if', `erc-delete-if', `erc-remove-if-not'
`erc-subseq' is a verbatim duplicate of `subseq'.

gnus-util.el has `gnus-merge' which is a modified version of cl.el's `merge'
It does a noop for its TYPE arg (but includes it for compatibility) and omits
the "&rest cl-keys" from its lambda-list.

It also provides a function `gnus-mapcar' which is a variant of `mapcar*'
without `cl-mapcar-many' dependence.

`gnus-remove-if' is similar to `remove-if' without CL keywords.

Are there any others like this that I've missed?

Following is a list of cl.el derived feautres which don't appear (as best I can
tell) to rely on cl keywords. I've attempted to enumerate where a given symbol
carries a `cl-compiler-macro` property or `cl-byte-compile-compiler-macro` and
`byte-compile-inline-expand` property values.

Surely some of these are good canditdates for moving into core.  They're
certainly tested, documented and some of them are significantly optimized away
by the byte-compiler.

;; artithmetic
`gcd'            ;(symbol-plist 'gcd)
                 ;=> side-effect-free t

`lcm'            ;(symbol-plist 'lcm)
                 ;=> side-effect-free t

`isqrt'          ;(symbol-plist 'isqrt)
                 ;=> side-effect-free t

`signum'         ;(symbol-plist 'signum)
                 ;=> side-effect-free t

`equalp'         ;(symbol-plist 'equalp)
                 ;=> side-effect-free error-free

`plusp'  ;(symbol-plist 'plusp)
         ;=> side-effect-free t
         ;   byte-compile cl-byte-compile-compiler-macro
         ;   cl-compiler-macro (lambda (w x) (list (quote >) x 0))

`minusp' ;(symbol-plist 'minusp)
         ;=> side-effect-free t byte-compile
         ;    cl-byte-compile-compiler-macro
         ;    cl-compiler-macro (lambda (w x) (list (quote <) x 0)))

`oddp'   ;(symbol-plist 'oddp)
         ;=> side-effect-free t

`evenp'  ;(symbol-plist 'evenp)
         ;=> side-effect-free t

;; generalized

;; type

;; matching
`notevery'  ;(symbol-plist 'notevery)
            ;=> byte-optimizer byte-compile-inline-expand

`notany'    ;(symbol-plist 'notany)
            ;=> byte-optimizer byte-compile-inline-expand

;; mapping
`map'       ;(symbol-plist 'map)
            ;=> byte-optimizer byte-compile-inline-expand

;; seqs
`concatenate' ;(symbol-plist 'concatenate)
              ;=> byte-optimizer byte-compile-inline-expand

`revappend'   ;(symbol-plist 'revappend)
              ;=> byte-optimizer byte-compile-inline-expand

`nreconc'     ;(symbol-plist 'nreconc)
              ;=> byte-optimizer byte-compile-inline-expand

`list-length' ;(symbol-plist 'list-length)
              ;=> side-effect-free t

`endp'       ;(symbol-plist 'endp);
             ;=> side-effect-free t
             ;   byte-compile cl-byte-compile-compiler-macro
             ;   cl-compiler-macro (lambda (w x) (list (quote null) x)))

`acons'  ; (symbol-plist 'acons)
         ;=> side-effect-free error-free
         ;   byte-optimizer byte-compile-inline-expand

`list*'  ;(symbol-plist 'list*)
         ;=> side-effect-free error-free
         ;   byte-compile cl-byte-compile-compiler-macro
         ;   compiler-macro-file "cl-macs.el"
         ;   cl-compiler-macro #[ ...byte-code-vector elided ]

`ldiff'    ;(symbol-plist 'ldiff)
           ;=> side-effect-free t

`pairlis'  ;(symbol-plist 'pairlis)
           ;=> side-effect-free t

;; These don't have `cl-' namespacing for symbol-name or the local vars.

;; This one doesn't have `cl-' namespacing for the local vars.


reply via email to

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