<fabricemarchant@free.fr> wrote:
+---------------
| > I can send you an original "siod.1.3.c",
| I'm interested with this, thanks !
+---------------
[Done.]
+---------------
| >- You're not going to learn much new from looking at anything
| > earlier than 1.3, since 1.3 is the first one that says
| > "define now works properly". (!!)
| That sounds very bad indeed.
+---------------
Why "bad"?!? SIOD 1.0 was a one-afternoon hack, as the documentation
is quite explicit about:
http://people.delphiforums.com/gjc/siod.html#apology
Apology, discussion and motivation
...
Defining and executing fib resulted in a code-coverage of over
95% of the lines of the C program. Hence, SIOD, Scheme in One Day.
I see nothing wrong in taking only a week more to make DEFINE "work
properly".
+---------------
| >- You're not going to learn much new from looking at 1.3
| > that you wouldn't learn from a somewhat later, more featureful
| > version such as 2.7 [May 1992] or even 3.4 [May 1997].
| I think : older -> simpler -> easier to study and understand !
| The reason I was interested in 1.0 is it doesn't implement macro.
| So I hoped the sources are lighter.
+---------------
Given that the source says that macros [and LOAD, and predicates!]
were added in 1.1, just one *day* later than 1.0, my guess is that
1.0 is practically useless, except for running his initial FIB demo.
Look, macros are practically trivial to implement, yet without them
it's a horrible pain to implement the *rest* of the language. No Lisp
or Scheme without them is "real".
Specifically, in SIOD 1.3 the implementation of macros is a 4-line hack
in EVAL, namely, if the value of a variable in function position of a
form is itself a *symbol* [rather than a function], then EVAL assumes
that that symbol names a macro function, calls it with the form, and
then loops to re-evaluate the result[*]:
...
case tc_cons:
tmp = leval(CAR(x),env);
switch TYPE(tmp) {
...[all the other usual cases]...
[*]==> case tc_symbol:
[*]==> x = cons(tmp,cons(cons(sym_quote,cons(x,NIL)),NIL));
[*]==> x = leval(x,NIL);
[*]==> goto loop;
default:
err("bad function",tmp);}
...
That's it. Really. Out of the total of 1147 lines of source code,
those 4 are all it took to implement macros [at least, the kind
that SIOD has].
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607