[plt-scheme] Best style on argument checking...

From: Eli Barzilay (eli at barzilay.org)
Date: Mon Mar 26 18:02:43 EDT 2007

On Mar 26, Paulo J. Matos wrote:
> 
> Problem is str might not be a string and the rest of the arguments may
> not have correct type. And args can have 3 arguments [probably we
> would like to warn the user about it].

To get the optional argument checking, you can do this:

  (require (lib "kw.ss"))
  (define/kw (append-all str #:optional num str)
    ...)

or use opt-lambda.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.