Changes between Version 41 and Version 42 of ExplicitCallStack


Ignore:
Timestamp:
Jan 30, 2007 4:36:53 PM (9 years ago)
Author:
guest
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ExplicitCallStack

    v41 v42  
    9393                  False -> n * fac (n - 1)
    9494}}}
     95
     96People probably don't write code like this very much, but nonetheless, it does expose some of the issues we must deal with.
    9597
    9698Here is a basic term-reduction for the program:
     
    109111By the time that `hd` is called on the empty list, the only thing remaining on the dynamic evaluation stack is `print`.
    110112
    111 The question is what stack would you "like" to see in this case?
     113The question is what stack would you ''like'' to see in this case?
     114
     115One option is this:
     116{{{
     117   main -> d -> e -> f -> hd
     118}}}
     119
     120Another option is this:
     121{{{
     122   main -> d -> hd
     123}}}
     124
     125The difference between these two stacks is how we determine ''when'' `hd` is called. Is it in the context where `hd` is first mentioned by name (in the body of `f`), or is it when `hd` becomes fully saturated (in the body of `d`). Both contexts seem reasonable. Does it really matter which one is chosen? At the moment I can't say for sure.
     126
     127There are more possibilities, for instance, we treat CAFs as roots of the stack, thus dropping `main` and `d` from the first of the options above:
     128{{{
     129   e -> f -> hd
     130}}}
     131
     132And so on.
     133
     134
    112135
    113136== Transformation rules ==