[racket] Constructors for sequences

From: Ryan Culpepper (ryan at cs.utah.edu)
Date: Sun Apr 29 18:47:53 EDT 2012

On 04/29/2012 04:33 PM, Matthias Felleisen wrote:
> On Apr 29, 2012, at 6:29 PM, Asumu Takikawa wrote:
>> On 2012-04-29 12:43:48 -0400, Matthias Felleisen wrote:
>>> What you're really saying is that sequence-map uses the wrong kind of type. Specifically, it should be polymorphic in the sequence constructor instead of mapping everything to the top of the class hierarchy (sequence).
>> I don't think this is just a type issue. The sequence that is returned
>> by `sequence-map` is lazy, even if the original sequence was not. That's
>> why you can't get the original type.
>> Cheers,
>> Asumu
> Why is it lazy?
> Can we add a strict one that is polymorphic (I apologize to the
> defenders of proper type terminology here for the applying this word
> to a dynamic aspect of Racket programs) in the sequence type-tag?

Another problem is that not all sequence types are polymorphic. For 
example, strings are sequences, but strings can contain only characters. 
So what would

   (sequence-map char->integer "abc")

return? Custom sequence types can add arbitrary additional constraints.


Posted on the users mailing list.