

                                                                scan-multiple

    FUNCTION
SCAN-MULTIPLE TYPE FIRST-SEQUENCE &rest MORE-SEQUENCES           [Function]

    Package
    series

    DESCRIPTION

Several sequences can be scanned at once by using several calls on SCAN.
Each call on SCAN will test to see when its sequence runs out of elements
and execution will stop as soon as any of the sequences are exhausted.
Although very robust, this approach to scanning can be a significant source
of inefficiency.  In situations where it is known in advance which sequence
is the shortest, SCAN-MULTIPLE can be used to obtain the same results more
rapidly.
  
SCAN-MULTIPLE is similar to SCAN except that several sequences can be
scanned at once.  If there are N sequence inputs, SCAN-MULTIPLE returns N
series containing the elements of these sequences.  It must be the case
that none of the sequence inputs is shorter than the first sequence.  All
of the output series are the same length as the first input sequence.
Extra elements in the other input sequences are ignored.  Using
SCAN-MULTIPLE is more efficient than using multiple instances of SCAN,
because SCAN-MULTIPLE only has to check for the first input running out of
elements.

If TYPE is of the form (VALUES t1 ... tm), then there must be M sequence
inputs and the ith sequence must have type ti.  Otherwise there can be any
number of sequence inputs, each of which must have type TYPE.

(MULTIPLE-VALUE-BIND (DATA WEIGHTS) 
    (SCAN-MULTIPLE 'LIST '(1 6 3 2 8) '(2 3 3 3 2)) 
  (COLLECT (MAP-FN T #'* DATA WEIGHTS))) 
 => (2 18 9 6 16)


     SEE ALSO
     about-series
     about-generators

;Copyright 1989 by the Massachusetts Institute of Technology,
;Cambridge, Massachusetts.

;Permission to use, copy, modify, and distribute this software and its
;documentation for any purpose and without fee is hereby granted,
;provided that this copyright and permission notice appear in all
;copies and supporting documentation, and that the name of M.I.T. not
;be used in advertising or publicity pertaining to distribution of the
;software without specific, written prior permission. M.I.T. makes no
;representations about the suitability of this software for any
;purpose.  It is provided "as is" without express or implied warranty.

;    M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
;    ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
;    M.I.T. BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
;    ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
;    WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
;    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
;    SOFTWARE.



