[Q] Accept circular lists where that is useful in #'mapcar*, #'map* and friends.
kehoea at parhasard.net
Sat Sep 18 12:10:07 EDT 2010
Ar an seachtú lá déag de mí Méan Fómhair, scríobh Stephen J. Turnbull:
> Is this standard CL?
Standard CL is fine with circular lists hanging your process. The circular
list checking is unique to XEmacs, we didn’t inherit it from GNU.
> N.B. It has potentially severe performance implications, it seems to
> me, since every list must be checked for length/circularity before
> iterating, whereas in the current implementation this can be checked
> as we go, and simply throw the error when discovered.
No. We always have taken the length of SEQUENCE in #'mapcar before starting
the iterations, because we behave as so:
(let ((list '(1 2 3 4 5 6 7 8 9)))
(mapcar #'(lambda (object) (fill list nil) object) list))
=> (1 2 3 4 5 6 7 8 9)
That is, FUNCTION can assume that each element it sees reflects what was in
SEQUENCE before any iteration. We need the length of SEQUENCE to do the
allocate the stack space for this.
> Aidan Kehoe writes:
> > changeset: 5273:799742b751c8 tag: tip user: Aidan Kehoe
> > <kehoea at parhasard.net> date: Thu Sep 16 20:34:49 2010 +0100 files:
> > lisp/cl-extra.el src/ChangeLog src/fns.c description: Accept
> > circular lists where that is useful in #'mapcar*, #'map* and
> > friends.
> XEmacs-Patches mailing list
> XEmacs-Patches at xemacs.org
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
-- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research
More information about the XEmacs-Patches