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
____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to