[racket] About genericity...
On 2014-04-02 20:53:58 +0200, Alejandro Zamora Fonseca wrote:
> ¿How can I create generic-functions in Racket?
>
> Something like
> this samples in CL:
>
> (defmethod dup ((a string))
> (concatenate 'string a a))
>
> (defmethod dup ((a integer))
> (list a a))
See the docs for the `racket/generic` library:
http://docs.racket-lang.org/reference/struct-generics.html
In particular, if you want functions with specialized behavior on
strings and integers, you'll need to use the #:defaults clause because
Racket does not allow a "monkeypatching"-like approach to overriding
behavior.
Cheers,
Asumu