chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Re: A few questions


From: David Brown
Subject: Re: [Chicken-users] Re: A few questions
Date: Thu, 31 Jan 2008 08:51:11 -0800
User-agent: Mutt/1.5.16 (2007-06-09)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]