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

implied contracts in the mapping functions?

I would appreciate comments on the following "bug report" i just
Date: Sat, 17 Sep 1983 15:59:00 -0000
Subject:  bug in mapc
To: bug-nil@mit-mc

I am iterating over a list and simultaneously adding things to the end of
the list with NCONC.  It works fine until I get down to the final iteration.
If I then NCONC something on to the end of the list, MAPC exits without
looking at the newly added list elements.
. . .
The manual neither implies that this should work, nor that it might not.
My impression on this is that using a mapping function is inappropriate
here, and the (unintentional) optimization which causes his case to fail
is allowable with the mapping functions.  On the other hand, since it is
so likely for this to actually work (i bet it does in most other
implementations, and in fact it only fails in NIL in the interpreter when
there is exactly one list argument to the MAPC, MAPCAN, and MAPCAR), it
may not be worth the conceptual overhead to disallow this sort of hacking
when it seems so "obvious" that it should work.