Mercurial > hg > xemacs-beta
comparison src/bytecode.c @ 5300:9f738305f80f
Accept sequences generally, not just lists, #'reverse, #'nreverse.
src/ChangeLog addition:
2010-11-06 Aidan Kehoe <kehoea@parhasard.net>
* bytecode.c (bytecode_nreverse): Call Fnreverse() if SEQUENCE is
not a cons in this function.
(Fnreverse, Freverse):
Accept sequences, not just lists, in these functions.
man/ChangeLog addition:
2010-11-06 Aidan Kehoe <kehoea@parhasard.net>
* lispref/lists.texi (Rearrangement, Building Lists):
Document that #'nreverse and #'reverse now accept sequences, not
just lists, in this file.
tests/ChangeLog addition:
2010-11-06 Aidan Kehoe <kehoea@parhasard.net>
* automated/lisp-tests.el (list-nreverse):
Check that #'reverse and #'nreverse handle non-list sequences
properly.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 06 Nov 2010 21:18:52 +0000 |
parents | 39d74978fd32 |
children | c096d8051f89 46491edfd94a |
comparison
equal
deleted
inserted
replaced
5299:28651c24b3f8 | 5300:9f738305f80f |
---|---|
249 obj = wrong_type_argument (Qnumber_char_or_marker_p, obj); | 249 obj = wrong_type_argument (Qnumber_char_or_marker_p, obj); |
250 goto retry; | 250 goto retry; |
251 } | 251 } |
252 | 252 |
253 static Lisp_Object | 253 static Lisp_Object |
254 bytecode_nreverse (Lisp_Object list) | 254 bytecode_nreverse (Lisp_Object sequence) |
255 { | 255 { |
256 REGISTER Lisp_Object prev = Qnil; | 256 if (LISTP (sequence)) |
257 REGISTER Lisp_Object tail = list; | |
258 | |
259 while (!NILP (tail)) | |
260 { | 257 { |
261 REGISTER Lisp_Object next; | 258 REGISTER Lisp_Object prev = Qnil; |
262 CHECK_CONS (tail); | 259 REGISTER Lisp_Object tail = sequence; |
263 next = XCDR (tail); | 260 |
264 XCDR (tail) = prev; | 261 while (!NILP (tail)) |
265 prev = tail; | 262 { |
266 tail = next; | 263 REGISTER Lisp_Object next; |
264 CHECK_CONS (tail); | |
265 next = XCDR (tail); | |
266 XCDR (tail) = prev; | |
267 prev = tail; | |
268 tail = next; | |
269 } | |
270 return prev; | |
267 } | 271 } |
268 return prev; | 272 else |
273 { | |
274 return Fnreverse (sequence); | |
275 } | |
269 } | 276 } |
270 | 277 |
271 | 278 |
272 /* We have our own two-argument versions of various arithmetic ops. | 279 /* We have our own two-argument versions of various arithmetic ops. |
273 Only two-argument arithmetic operations have their own byte codes. */ | 280 Only two-argument arithmetic operations have their own byte codes. */ |