Formal comment #26 (enhancement) Map and for-each should work even if lists are of unequal length Reported by: John Cowan Component: baselibrary Version: 5.91 The R6RS definitions of "map" and "for-each" should permit the list arguments to be of unequal length, and specify that they terminate when the shortest list runs out. This is what SRFI-1 does, it is cheap, and it is useful. RESPONSE: The proposal is indeed cheap to implement, may be more useful than the draft R6RS semantics, and has one of the most widely used SRFIs as precedent. It may, however, mask errors where lists of different lengths are supplied by mistake, and the semantics becomes unclear when input lists are extended destrutively as side effects of invoking the procedural arguments. To investigate precedent further, several implementations were tested to see whether they allow list arguments of different lengths: Bigloo 2.7a error Petite Chez 7.0a error Chicken 2,5 error Gambit-C v4.0b20 error Kawa 1.8 okay (but does not allow circular lists) Larceny v0.93 okay (but does not allow circular lists) MIT Scheme 7.7.90.+ error MzScheme v352 error Scheme 48 v1.3 okay (but does not allow circular lists) SCM 5e1 okay (even with circular lists) It is questionable whether the SRFI-1 extension of these procedures to accept lists of differing lengths is so widely accepted that it should be required by the R6RS. On the other hand, the SRFI-1 extension is common enough the R6RS should perhaps not preclude it. One solution would be to specify map and for-each essentially as in R5RS: If list arguments have different lengths, then an exception might be raised, but is not required. Portable programs would not be able to depend upon the extension, and would also not be able to depend upon the exception being raised. While we are still studying this issue, the editors intend to resolve this issue in a manner consistent with our resolution of formal comment #87.