From: Ken Harris Date: Fri, 14 Jun 2013 16:50:40 +0000 (-0700) Subject: VECTOR function X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=3b1d76c5bc0117f48e386bbf007321cde90bce5f;p=jscl.git VECTOR function --- diff --git a/src/array.lisp b/src/array.lisp index 150c70d..b66d87c 100644 --- a/src/array.lisp +++ b/src/array.lisp @@ -79,6 +79,14 @@ (defun vectorp (x) (and (arrayp x) (null (cdr (array-dimensions x))))) +(defun vector (&rest objects) + (let* ((length (length objects)) + (array (make-array length :element-type t)) + (i 0)) + (dolist (element objects array) ;; poor-man's :initial-contents + (aset array i element) + (incf i)))) + ;;; FIXME: should take optional min-extension. ;;; FIXME: should use fill-pointer instead of the absolute end of array (defun vector-push-extend (new vector)