[racket] Constructors for sequences
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).
Interesting point is that you described/found this problem in a type-free world.
Question is how we should deal with this in Typed Racket, given our lack of bounded polymorphism
-- Matthias
On Apr 29, 2012, at 8:12 AM, Jens Axel Søgaard wrote:
> Given a sequence is there way to get the "constructor" of the sequence?
>
> (sequence-constructor (list 1 2 3)) = list
> (sequence-constructor (vector 1 2 3)) = vector
> etc
>
> I'd like to use it for a declare-mappable macro that extends functions
> of one argument
> to map over sequences. As in (sin (list 1 2 3)) = (list (sin 1) (sin
> 2) (sin 3)).
>
> The sequence-map function is close, but it produces sequences.
> Now I could of course hard code the usual suspects, but it seems
> somewhat inelegant.
>
> --
> Jens Axel Søgaard
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users