Changeset 12516 for trunk/abcl/src/org/armedbear/lisp/reduce.lisp
- Timestamp:
- 03/03/10 21:05:41 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/reduce.lisp
r11391 r12516 34 34 (in-package #:system) 35 35 36 (require "EXTENSIBLE-SEQUENCES-BASE") 37 36 38 (defmacro list-reduce (function sequence start end initial-value ivp key) 37 39 (let ((what `(if ,key (funcall ,key (car sequence)) (car sequence)))) … … 57 59 58 60 59 (defun reduce (function sequence & key from-end (start 0)61 (defun reduce (function sequence &rest args &key from-end (start 0) 60 62 end (initial-value nil ivp) key) 61 63 (unless end (setq end (length sequence))) 62 64 (if (= end start) 63 65 (if ivp initial-value (funcall function)) 64 ( if (listp sequence)66 (sequence::seq-dispatch sequence 65 67 (if from-end 66 68 (list-reduce-from-end function sequence start end initial-value ivp key) … … 81 83 value (funcall function 82 84 (if from-end element value) 83 (if from-end value element)))))))) 85 (if from-end value element))))) 86 (apply #'sequence:reduce function sequence args))))
Note: See TracChangeset
for help on using the changeset viewer.