Bengt Kleberg <bengt.kleberg@swip.net> wrote:
+---------------
| Is there a procedure library available for siod, that 'emulates' R4RS
| procedures? Like (list-ref ...), (open-input-file ...)?
+---------------
No, and there really can't be -- at least, not without a *lot* of hacking
on the internals of SIOD. Oh, sure, you can wrap some syntactic sugar
around some of the differences with procedure & macro definitions, but
there are some really fundamental things -- whether you call them bugs,
features, or simplifications depends on what you're trying to do that
day -- that just don't map to R4RS well enough that you could ever hope
to pass, say, Jaffer's "r4rstest.scm". Here are a few:
- Symbols are case-sensitive; there's no provision (that I could find)
for turning that off.
- Numbers are C doubles. Only. No bignums. No "exacts". Where an exact
integer is needed (e.g., as a list or array index), the C double is
silently coerced to a C long [truncated]. Where the functionality of
R4RS "exact?" is needed (internally, since it's not exposed to the user),
say, for deciding whether to print a decimal point or not, it's defined
as being able to coerce the number to a C long and back to a float and
get the identical original float back.
- There is no separate character type; numbers are used (as in C),
silently coerced to int. E.g., (putc 65.43) prints an "A".
- There is no separate boolean type. #t == 1.0 and #f == nil == ().
The symbol 't is bound to itself, so it also is true when used in
a boolean context, but it's not literally "1.0" the way "#t" is.
And while "nil" isn't a number per se, due to the way the subroutine
calls are done it's treated as "zero". So (+ 4 3 #f 2 #t 1) ==> 11
(with no error reported).
That is *NOT* to say that SIOD is not a useful, small, fast-startup
[though slower-running] dialect of Scheme that's easy to glue to C code,
and that comes with some nice extensions for networking & web hacking &
database interfacing. It is! None of the above "features" get in the
way of using it as a small scripting language. But it's really not very
close to R4RS...
-Rob
-----
Rob Warnock, 8L-855 rpw3@sgi.com
Applied Networking http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
2011 N. Shoreline Blvd. FAX: 650-964-0811
Mountain View, CA 94043 PP-ASEL-IA