[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Implementation of MAP, SOME, EVERY, etc...
- To: Dan Corkill <cork%umass-cs.csnet@CSNET-RELAY.ARPA>
- Subject: Implementation of MAP, SOME, EVERY, etc...
- From: David A. Moon <Moon@SCRC-STONY-BROOK.ARPA>
- Date: Wed, 27 Mar 85 16:17 EST
- Cc: common-lisp@SU-AI.ARPA
- Comment: Message remailed after delay caused by distribution list error.
- In-reply-to: The message of 19 Mar 85 11:58-EST from Dan Corkill <email@example.com>
Date: Tue, 19 Mar 85 11:58 EST
From: Dan Corkill <firstname.lastname@example.org>
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.