On Apr 19, 2009, at 11:45 AM, Abdulaziz Ghuloum wrote:

I can't justify it either.

Maybe I can explain it now (but not justify it).

Every time you do an (import (for (T) run expand)), (T) needs to be first compiled, then visited, then invoked [plt terminology here, ikarus slightly different].

So, to run the script, first compile its dependencies, then visit them, then invoke them. To compile a library, first compile its dependencies, then visit them, then invoke the ones required for meta > 0. To visit a library, first visit its dependencies (since they're imported for run), then invoke them (since they're imported for expand). To invoke a library, first invoke its dependencies (since they're imported for run)

To run t.sps, what plt-r6rs does is:
  compile T3
    compile T2
      compile T1
        compile T0
        visit T0
        invoke T0
      visit T1
        visit T0
        invoke T0
      invoke T1
        invoke T0
    visit T2
      visit T1
        visit T0
        invoke T0
      invoke T1
        invoke T0
    invoke T2
      invoke T1
        invoke T0
  visit T3
    visit T2
      visit T1
        visit T0
        invoke T0
      invoke T1
        invoke T0
    invoke T2
      invoke T1
        invoke T0
  invoke T3
    invoke T2
      invoke T1
        invoke T0

If you do a depth-first traversal recording the invokes, you'd get:

T0
T0
T0
T1
T0
T0
T1
T0
T1
T2
T0
T0
T1
T0
T1
T2
T0
T1
T2
T3

which is exactly what I'm getting with plt-r6rs.

Aziz,,,

Reply via email to