[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
maplist and lists
Date: Tue, 6 Jan 87 12:57 EST
From: Brad Miller <miller@ACORN.CS.ROCHESTER.EDU>
Date: Tue, 6 Jan 87 11:35 EST
From: David C. Plummer <DCP@QUABBIN.SCRC.Symbolics.COM>
Date: Tue, 6 Jan 87 11:07 EST
From: Brad Miller <miller@ACORN.CS.ROCHESTER.EDU>
What do you want
(maplist #'list '(1 2 3 . 4) '(a b . c) '(x y z w q r s))
to return, and why? What I'm asking for is your "well defined"
definition.
(((1 2 3 . 4) (a b . c) (x y z w q r s))
((2 3 . 4) (b . c) (y z w q r s))
((3 . 4) c (z w q r s)))
since there are no further cdr's of the middle form that would be it!
One can argue that
w/o dotted lists one can continue to take cdrs (getting nil) until all lists
are ended, but using a dotted list, you "wave" that - one of the lists
finished, so there are no further maps to be done. Note that this is not a
problem it might be with MAPCAR, where a lot of information might be
(silently) lost, though the same principle could apply...
That's pretty much what I expected. That still doesn't give an EXACT
definition. Consider
(maplist #'identity '(1 2 3))
vs (maplist #'identity '(1 2 3 . nil))
One could argue the final "dotted" NIL should be explicitly passed, and
the result of both would be
((1 2 3) (2 3) (3) NIL)
instead of the current
((1 2 3) (2 3) (3))