[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Extension to MAP
- To: common-lisp@SAIL.STANFORD.EDU
- Subject: Extension to MAP
- From: Jim Hassett <HASSETT%sp.unisys.com@RELAY.CS.NET>
- Date: Mon, 23 Mar 87 08:47 CST
Date: Sat, 21 Mar 87 15:42 EST
From: Barry Margolin <firstname.lastname@example.org>
Date: 20 Mar 1987 16:24-EST
I'd really like to see MAP take a sequence as its first
argument, and have the results be put into that sequence.
Unfortunately, MAP already has a defined meaning when its first argument
is a sequence, because a list is a sequence and there are type
specifiers that are lists.
Right. We can't allow another interpretation for something that might be a
Date: Sat, 21 Mar 87 15:56:37 PDT
CLTL states that the first argument to MAP must be NIL or a subtype of
sequence. Propose we extend so that if the first argument is anything
else then the result type is of the type of the first sequence. In
(map t function seq1 ...) => <sequence of type seq1>
would give you your desired effect.
One problem here is that T is a type specifier (though it does not specify
a subtype of SEQUENCE). A more serious problem is that it doesn't do what
was originally desired: modify an existing sequence (or is it proposed to
modify SEQ1?). Also, SEQ1 might not happen to be of the desired result type.
One possible upward-compatible extension would be to allow the first argument
to be a list of the form (onto <sequence>). There is no ambiguity since this
is not a type specifier. In actual use, the backquote would be the most
convenient means of constructing such a list:
(map `(onto ,my-result-sequence) function seq1 ...)