This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: questions about kawa (or possibly scheme)
- From: Per Bothner <per at bothner dot com>
- To: Don Cohen <don-kawa at isis dot cs3-inc dot com>
- Cc: kawa at sourceware dot org
- Date: Tue, 09 Sep 2008 12:31:55 -0700
- Subject: Re: questions about kawa (or possibly scheme)
- References: <20080909190947.4E2EE1A818F@isis.cs3-inc.com>
Don Cohen wrote:
The main question is where I should look (if there is any such place)
for answers to questions such as those below.
I've never seriously used scheme. I do use common lisp.
Is defmacro part of the latest scheme or a kawa addition?
defmacro is non-standard and strongly discouraged.
Use define-syntax (standard), or define-syntax-case (a
convenience macro on top of define-syntax - see the Kawa
manual).
Is there a type-of function (to return the type of its argument) ?
We should distinguish: a "type" is a compile-time property of a
variable or an expression; at run-time objects have a reference
to their "class". You can get the latter with the Java method
getClass:
(invoke foo 'getClass)
or
(foo:getClass)
or just
foo:class
This returns the Java class which is a little lower-level than
the Scheme types. I.e. (4:getClass) prints "class gnu.math.IntNum"
rather than "Type integer", which is what you get if you just
evaluate the "type expression" "integer".
Is there something way to find what symbols have function bindings
like *packages* and do-symbols ?
Do remember that Kawa is very compiler-oriented. So, to a large
extent is Scheme - especially R6RS. Function bindings may be
local to a module or other scope, in which case they're not
accessible from a symbol or package.
Kawa does have packages and a way to get at symbols, but it's
not really supported. What do you need this for? Perhaps
you'r asking the wrong question?
with-input-from-string ?
open-input-string or call-with-input-string
BTW, it took me a while to figure out that write returns (values).
Yes. It and many similar functions that the Scheme standards
specify as returning "unspecified" in Kawa have void type, which
is equivalent to them always returning zero values.
--
--Per Bothner
per@bothner.com http://per.bothner.com/