[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Implementation of MAP, SOME, EVERY, etc...



    Date:     Tue, 19 Mar 85 11:58 EST
    From:     Dan Corkill <cork%umass-cs.csnet@csnet-relay.arpa>


    There is an easily made implementation error in MAP, SOME, EVERY, etc.
    The published semantics indicate that these functions use the length of
    the shortest argument sequence to determine how many iterations to 
    perform (and in this way parallel the semantics of mapc, mapcar, etc.).

    Thus it would appear that:

	    (map 'list '+ '(1 2 3) (star 2))

    where star builds a circular list of its argument should be legal and
    return => (3 4 5).

    Implementations that use length to check the length of argument sequences
    will break on such a call.

The Common Lisp LENGTH function returns NIL when given a circular list.