[plt-scheme] define/public doesn't like my macro

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Thu Jun 8 06:17:30 EDT 2006

Hi all,

I usually have to define a function which depends on the type of the
first argument so I sketched the following macro a long time ago which
is part of my utils and have been using without problems:
(define-syntax type-lambda
    (syntax-rules ()
      [(type-lambda (arg ...) (p l) ...)
       (lambda (arg ...)
         (let ([testarg (first (list arg ...))])
           (let loop ([preds (list p ...)]
                      [thunks (list l ...)])
             (cond [(null? preds)
                    (error 'type-lambda
                           "No predicate passed was able to handle: ~a~n"
                   [((first preds) testarg)
                    ((first thunks))]
                    (loop (rest preds)
                          (rest thunks))]))))]))

Now I'm trying to use it inside a method:
(define test
        (type-lambda (x)
                     (string? (lambda () "String"))
                     ((lambda (t) #t) (lambda () "Something else"))))

This works... a private method but this...
(define/public test
        (type-lambda (x)
                     (string? (lambda () "String"))
                     ((lambda (t) #t) (lambda () "Something else"))))

class: bad form for method definition in: (type-lambda (x) (string?
(lambda () "String")) ((lambda (t)  #t) (lambda () "Something else")))

Any ideas why?
Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering

Posted on the users mailing list.