[plt-scheme] Re: polymorphism of primitive types

From: David Van Horn (dvanhorn at cs.brandeis.edu)
Date: Tue Oct 18 12:26:29 EDT 2005

Matthias Felleisen wrote:
> I was wrong. R5RS says:
> 
>> library procedure:  (map proc list1 list2 ...) 
>>
>> The lists must be lists, and proc must be a procedure taking as many
>> arguments as there are lists and returning a single value. If more
>> than one list is given, then they must all be the same length.
> 
> So this means you must redefine map for cyclic lists just as you must
> for streams.

Or use SRFI 1.

   http://srfi.schemers.org/srfi-1/srfi-1.html#Map

This procedure is extended from its R5RS  specification to allow the
arguments to be of unequal length; it terminates when the shortest list
runs out.

At least one of the argument lists must be finite:

(map + '(3 1 4 1) (circular-list 1 0)) => (4 1 5 1)



Posted on the users mailing list.