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: Alex Queiroz
Subject: Re: [Chicken-users] Re: A few questions
Date: Thu, 31 Jan 2008 14:43:39 -0200

Hallo,

On Jan 31, 2008 2:27 PM, Elf <address@hidden> wrote:
>
> we could just define a special form
> (define-with-docstring <name|lambda list> <list|string> body...)
> which would just be syntactic sugar for a define and a procedure-data.
> this of course leaves variables and macros undefined.
>

    Stealing names from Common Lisp:

(define-macro (describe name)
    `(get ,name 'docstring ""))

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

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

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

Cheers,
-- 
-alex
http://www.ventonegro.org/




reply via email to

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