Update of /project/elephant/cvsroot/elephant/src/elephant In directory clnet:/tmp/cvs-serv25290/src/elephant
Modified Files: classindex.lisp collections.lisp Log Message: Documentation edits; document collect and fix picture insertion
--- /project/elephant/cvsroot/elephant/src/elephant/classindex.lisp 2007/04/29 02:10:54 1.42 +++ /project/elephant/cvsroot/elephant/src/elephant/classindex.lisp 2007/05/05 22:10:40 1.43 @@ -390,7 +390,9 @@
(defun map-class (fn class &key collect) "Perform a map operation over all instances of class. Takes a - function of one argument, a class instance" + function of one argument, a class instance. Setting the collect + keyword to true will return a list of the values returned from + calls to fn on successive instances of the class." (let* ((class (if (symbolp class) (find-class class) class)) @@ -407,20 +409,8 @@ defined by the index. Specify the class and index by quoted name. The index may be a slot index or a derived index.
- To map only a subset of key-value pairs, specify the range - using the :start and :end keywords; all elements greater than - or equal to :start and less than or equal to :end will be - traversed regardless of whether the start or end value is in - the index. - - Use nil in the place of start or end to specify the first - element or last element, respectively. - - To map a single value, iff it exists, use the :value keyword. - This is the only way to travers all nil values. - - To map from :end to :start in descending order, set :from-end - to true. If :value is used, :from-end is ignored" + Read the docstring for map-index for details on what the + various keywords do." (declare (dynamic-extent args) (ignorable args)) (let* ((index (if (symbolp index) --- /project/elephant/cvsroot/elephant/src/elephant/collections.lisp 2007/04/29 02:10:54 1.30 +++ /project/elephant/cvsroot/elephant/src/elephant/collections.lisp 2007/05/05 22:10:40 1.31 @@ -408,7 +408,10 @@ If values are not provided, then it maps over all values. BTrees do not have duplicates, but map-btree can also be used with indices in the case where you don't want access to the primary key so we - require a value argument as well for mapping duplicate value sets.")) + require a value argument as well for mapping duplicate value sets. + The collect keyword will accumulate the results from + each call of fn in a fresh list and return that list in the + same order the calls were made (first to last)."))
;; NOTE: the use of nil for the last element in a btree only works because the C comparison ;; function orders by type tag and nil is the highest valued type tag so nils are the last @@ -465,7 +468,9 @@ the last element in the index. If you want to traverse only a set of identical key values, for example all nil values, then use the value keyword which will override any values of start - and end.")) + and end. The collect keyword will accumulate the results from + each call of fn in a fresh list and return that list in the + same order the calls were made (first to last)"))"))
(defmethod map-index (fn (index btree-index) &rest args &key start end (value nil value-set-p) from-end collect