Browse files

Extended map-column to handle vectors.

  • Loading branch information...
1 parent e29b741 commit 96db888a8d2c4f9cf84f779dcdbebfce63547afa @tpapp committed Jun 6, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/array.lisp
7 src/array.lisp
@@ -544,7 +544,12 @@ instead of a matrix.")
(if result-nrow
(setf (sub result t col-index) mapped-col)
(setf (aref result col-index) mapped-col))))
- result)))
+ result))
+ (:method (function (vector vector) &key element-type)
+ ;; FIXME ugly hack, forming a vector then extracting an element is not
+ ;; really elegant
+ (map-columns (lambda (c) (funcall function (aref c 0)))
+ (as-row vector) :element-type element-type)))
(defgeneric map-rows (function object &key element-type &allow-other-keys)
(:documentation "Map rows of object (eg a matrix) using FUNCTION.")

0 comments on commit 96db888

Please sign in to comment.