On Thu, Jan 31, 2008 at 02:43:39PM -0200, Alex Queiroz wrote:

(define-macro (defun name args docstr . body)
  `(let ()
     (define ,name (lambda ,args ,@body)
     (put! ,name 'docstring ,docstr)))

In common lisp, the docstring is optional.  Basically, if (string?
docstring) then use it, otherwise it is the beginning of the body.

(define-macro (defvar name docstr value)
   `(let ()
      (define ,name ,value)
      (put! ,name 'docstring ,docstr)))

In defvar, the docstr comes last, and is optional.

(define-macro (defmacro name args docstr . body)
    `(let ()
       (define-macro (,name ,@args) ,@body)
       (put! ,name 'docstring ,docstr)))

Similar comment to the defun.

David


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to