[Top][All Lists]

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

Re: [Chicken-users] docstrings

From: Kon Lovett
Subject: Re: [Chicken-users] docstrings
Date: Fri, 03 Dec 2010 11:57:58 -0800

On Dec 3, 2010, at 11:23 AM, David Dreisigmeyer wrote:

I've been going through "The Scheme Programming Language (4e)", and
was doing some experiments with define-syntax.  Can I do something
like the following (like in CL):

(define-syntax my-set!

"I WANT TO PUT SOME DOCUMENTATION HERE." [ <<-- can I do something like this?]

  (syntax-rules ()
    [(_ x1 ...)
(map (lambda (a) (eval (list 'set! (car a) (cadr a)))) (list x1 ...))]))

so I can do something like

(documentation #'foo 'function) => "I WANT TO PUT SOME DOCUMENTATION HERE."

Short answer - No. Chicken Scheme has APIs for extending a procedure with user defined data but no direct support for CL-like docstrings. So, while some basic support is available, work is required.

However, there is support for online documentation via interpreter extension. See the eggs page.

Any comments on my define-syntax example would be appreciated also.
Took me darn near to hours to get the above to work.

(define-syntax my-set!
  (syntax-rules ()
    ((_) (begin) )
((_ (?i0 ?v0) ?p1 ...) (begin (set! ?i0 ?v0) (my-set! ?p1 ...)) ) ) )

Not great but I think it does what you want :
  (my-set! (a 1) (b 2)) => (set! a 1) (set! b 2)



P.S. If there's a more appropriate forum for these general (i.e., not
necessarily Chicken specific) Scheme questions please let me know.

Chicken-users mailing list

reply via email to

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