chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] A few questions


From: Alex Queiroz
Subject: Re: [Chicken-users] A few questions
Date: Tue, 29 Jan 2008 16:24:37 -0200

Hallo,

On Jan 29, 2008 3:47 PM, Hans Nowak <address@hidden> wrote:
>
> 1. Does Chicken (or Scheme in general) support docstrings?
>

     No and no.

>
> Is there a way to do something similar in Chicken?  Or, in other words, is
> there a way for Chicken code to tell if it's being run a script, or being
> loaded as auxiliary code?
>

     Create a MAIN function (the name does not matter). When compiling
a stand-alone application, add this to the csc command line:

$ csc -postlude (main)

>
> But I cannot do the same thing with macros:
>
>    #;6> (define-macro (m x) `,x)
>    #;7> (m 3)
>    3
>    #;8> m
> Error: unbound variable: m
>
> Why is that?  There is probably a good reason why I cannot type 'm' and get
> back something like '#<macro (m x)>', but what is that reason?  Also, is there
> a way to get a list of defined macros?
>

     Macros are not first-class objects in Scheme. They are used to
preprocess your code before evaluation, therefore they don't live in
the environment. You can test the expasion of a macro with the
MACROEXPAND-1 procedure.

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




reply via email to

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