[racket] Constructors for sequences

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Sun Apr 29 08:12:07 EDT 2012

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


Posted on the users mailing list.