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 http://pre.racket-lang.org/docs/html/reference/struct-generics.html?q=generic 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
smime.p7s
Description: S/MIME cryptographic signature
____________________ Racket Users list: http://lists.racket-lang.org/users