[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] A few questions
From: |
Hans Nowak |
Subject: |
[Chicken-users] A few questions |
Date: |
Tue, 29 Jan 2008 12:47:14 -0500 |
User-agent: |
Thunderbird 2.0.0.0 (Macintosh/20070326) |
Hi,
I am studying Chicken this year (and blogging about it, as some people here
already discovered :-). So far I have been able to figure out most things by
myself (my experience with Scheme is limited, but I'm not a *complete*
beginner), but I still have a few unanswered questions. Maybe somebody here
can help me. Here goes...
1. Does Chicken (or Scheme in general) support docstrings?
2. Python has a way to make the same file usable as both a module and a
script. For example:
# foo.py
def bar(x): ...
if __name__ == "__main__":
bar(42)
When run as a script, all the code is executed; when imported, you get the
definitions, but the code inside the 'if' is omitted.
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?
3. This is more of a technical question about something that I haven't grasped
yet. When I define a function, I can "see" it at the toplevel, and refer to
it by name:
#;8> (define (f x) x)
#;9> f
#<procedure (f x)>
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?
Thanks,
--Hans
`
- [Chicken-users] A few questions,
Hans Nowak <=
- Re: [Chicken-users] A few questions, Alex Queiroz, 2008/01/29
- Re: [Chicken-users] A few questions, Kon Lovett, 2008/01/29
- [Chicken-users] Re: A few questions, Hans Nowak, 2008/01/29
- Re: [Chicken-users] Re: A few questions, Kon Lovett, 2008/01/29
- [Chicken-users] Re: A few questions, Hans Nowak, 2008/01/29
- Re: [Chicken-users] Re: A few questions, John Cowan, 2008/01/29
- Re: [Chicken-users] Re: A few questions, Kon Lovett, 2008/01/29
- Re: [Chicken-users] Re: A few questions, John Cowan, 2008/01/29