[racket] About genericity...

From: Daniel Prager (daniel.a.prager at gmail.com)
Date: Thu Apr 3 05:11:36 EDT 2014

Here's an out-of-the-box option, using Racket's pattern
matching<http://docs.racket-lang.org/reference/match.html#%28form._%28%28lib._racket%2Fmatch..rkt%29._define%2Fmatch%29%29>
with the
(? predicate) form:

(define/match (dup a)
  [((? string?)) (string-append a a)]
  [((? integer?)) (list a a)])

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140403/e85e10a0/attachment-0001.html>

Posted on the users mailing list.