[racket] About genericity...

From: Roman Klochkov (kalimehtar at mail.ru)
Date: Thu Apr 3 01:49:04 EDT 2014

 There is gls package  https://github.com/Kalimehtar/gls/tree/master

It is even more generic (you may use any predicate as a `type')

Your case is 

#lang racket
(require gls)
(defgeneric dup)
(add-method dup 
  (method ((a string?))
     (string-append a a)))
(add-method dup 
   (method ((a exact-integer?))
      (list a a))) For more CL-like approach (with defmethod, type-of and so on) you may use `swindle' (package or language).

Wed, 02 Apr 2014 20:53:58 +0200 от Alejandro Zamora Fonseca <terefv at ltu.sld.cu>:
>Hello everybody!
>I have a newbie question.
>¿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))
>    Alejandro
>Este mensaje le ha llegado mediante el servicio de correo electronico que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistema Nacional de Salud. La persona que envia este correo asume el compromiso de usar el servicio a tales fines y cumplir con las regulaciones establecidas
>Infomed:  http://www.sld.cu/
>  Racket Users list:
>   http://lists.racket-lang.org/users

Roman Klochkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140403/6be126a7/attachment.html>

Posted on the users mailing list.