[racket] polymorphic functions

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Oct 11 09:38:59 EDT 2012

What do you mean by polymorphic? 

parametric polymorphism: this is a type-level concept with no true material counterpart on the dynamic level. Since Racket is untyped, you can't ask for this. Naturally Typed Racket comes with first-class polymorphic functions. 

ad hoc polymorphism, aka generics (the better word to avoid confusion): if you want (length '(1 2 4)) == (length "123") == (length (vector 1 2 3)), then the historical response is that such functions violates the carefully chosen middl ground of Scheme, which wants the readers (of code) to understand from the function length, string-length, vector-length that the program is currently dealing with lists, strings, or vectors. 

Having said that, we recognize the need to support generic interfaces to new data structures. While this is still an experiment, you may wish to look at 


Keep watching for more ideas in this direction but don't hold your breath -- Matthias

On Oct 11, 2012, at 9:20 AM, Răzvan Rotaru wrote:

> Hi,
> I realized recently that one thing I miss in Racket are polymorphic core functions (car, cdr, map, etc.). So I was wondering what it would take to make them polymorphic. What is the best way to implement a polymorphic function in Racket? Any ideas, suggestions and critics are mighty welcome. Thanks.
> Razvan
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4373 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20121011/3dd37606/attachment.p7s>

Posted on the users mailing list.