Hi Roman > I think, Alejandro wanted to add clauses in different places (generic in one module, added method in another, for example).
Quite possibly, or perhaps not! ;-) Alejandro gave an example of one declaration mechanism that he'd seen in CL. Hard to tell whether that's optimal for his context, or if that's what he's familiar with. Dan On Thu, Apr 3, 2014 at 8:43 PM, Roman Klochkov <kalimeh...@mail.ru> wrote: > Or even simpler > > (define (dup a) > (cond > [(string? a) (string-append a a)] > [(integer? a) (list a a)]) > > :-) > > I think, Alejandro wanted to add clauses in different places (generic in > one module, added method in another, for example). > > > Thu, 3 Apr 2014 20:11:36 +1100 от Daniel Prager <daniel.a.pra...@gmail.com > >: > > 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 > > > > -- > Roman Klochkov > -- *Daniel Prager* Agile/Lean Coaching, Software Development and Leadership Startup: www.youpatch.com Twitter: @agilejitsu <https://twitter.com/agilejitsu> Blog: agile-jitsu.blogspot.com
____________________ Racket Users list: http://lists.racket-lang.org/users