comparison lisp/cl-extra.el @ 5339:ba62563ec7c7

Accept more complex TYPEs in #'concatenate, cl-extra.el lisp/ChangeLog addition: 2011-01-15 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (concatenate): Accept more complicated TYPEs in this function, handing the sequences over to #'coerce if we don't understand them here. * cl-macs.el (inline): Don't proclaim #'concatenate as inline, its compiler macro is more useful than doing that. tests/ChangeLog addition: 2011-01-15 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el (list): Test #'concatenate, especially with more complicated TYPEs, which were previously not accepted by the function.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 15 Jan 2011 15:45:46 +0000
parents f6471e4ae703
children 38e24b8be4ea a9094f28f9a9
comparison
equal deleted inserted replaced
5338:8608eadee6ba 5339:ba62563ec7c7
419 "Concatenate, into a sequence of type TYPE, the argument SEQUENCES." 419 "Concatenate, into a sequence of type TYPE, the argument SEQUENCES."
420 ;; XEmacs change: use case instead of cond for clarity 420 ;; XEmacs change: use case instead of cond for clarity
421 (case type 421 (case type
422 (vector (apply 'vconcat seqs)) 422 (vector (apply 'vconcat seqs))
423 (string (apply 'concat seqs)) 423 (string (apply 'concat seqs))
424 (list (apply 'append (append seqs '(nil)))) 424 (list (reduce 'append seqs :from-end t :initial-value nil))
425 (bit-vector (apply 'bvconcat seqs)) 425 (bit-vector (apply 'bvconcat seqs))
426 (t (error 'invalid-argument "Not a sequence type name" type)))) 426 (t (coerce (reduce 'append seqs :from-end t :initial-value nil) type))))
427 427
428 ;;; List functions. 428 ;;; List functions.
429 429
430 (defun revappend (x y) 430 (defun revappend (x y)
431 "Equivalent to (append (reverse X) Y)." 431 "Equivalent to (append (reverse X) Y)."