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

Extension to MAP

   Date: Sat, 21 Mar 87 15:42 EST
   From: Barry Margolin <barmar@think.com>

       Date: 20 Mar 1987 16:24-EST
       From: VERACSD@a.isi.edu

   	    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
type specifier.

   From: vrotney@venera.isi.edu
   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 ...)

Jim Hassett