[racket] About genericity...

From: Joan Arnaldich (jarnaldich at gmail.com)
Date: Fri Oct 24 06:11:07 EDT 2014

Hi there,

I stumbled upon this thread when searching for generics. I really like 
Alexander's solution, but if I understand it correctly, the my-match-lambda-
append function should read something like:

(define my-match-lambda-append
  (case-lambda
    [() (case-lambda)]
    [(f1 . f2) (lambda args
               (with-handlers ([exn:fail:my-match-lambda:no-match:next-
clause?
                                (λ (e) (apply (apply my-match-lambda-append  
f2) args))])
                 (parameterize ([within-my-match-lambda-append? #t])
                   (apply f1 args))))]))


Notice the dot clause and the recursive call. Otherwise it wouldn't work 
with more than 2 clauses... 

Just for completeness, I created a gist with the full code and updated tests: 
https://gist.github.com/jarnaldich/056a5856d3b1ce05c312#file-my-match-lambda-
rkt

Cheers,

Joan


Posted on the users mailing list.