Re: processing character entities

Subject: Re: processing character entities
From: "Russell Steven Shawn O'Connor" <roconnor@xxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 27 Jul 1999 18:01:18 -0400 (EDT)
On Tue, 27 Jul 1999, David Carlisle wrote:

> In your first version, the recursive call happened _inside_ an
> expression, that is bad, even though syntactically it looked to be at
> the end, tail recursion implies structuring things the other way, as in
> your second version.

To add to your point, The idea is to get your recursive call as the
outer-most call.  This is needed because parameters are always evaluated
first.

But with both examples the recursive call was inside an if statement, so
it isn't the outer-most call.  What's up with that?

The answer is that a few basic routines in scheme such as if don't
evaluate all their parameters first.  In the case of if it evaluates its
first parameter first, then only one of the next two paramters are
evaluated.

So the recursive call doesn't have to be the most outer-most call,  it can
be inside if, or case, or other such statements.

Since DSSSL is side-effect free, it would be possible to do call by name.
That is always evaluate parameters last.  Then cache the results of
function calls and reuse their values.  I don't know how practical this
approch would be.

-- 
Russell O'Connor                           roconnor@xxxxxxxxxxxx
       <http://www.undergrad.math.uwaterloo.ca/~roconnor/>
``And truth irreversibly destroys the meaning of its own message''
-- Anindita Dutta, ``The Paradox of Truth, the Truth of Entropy''



 DSSSList info and archive:  http://www.mulberrytech.com/dsssl/dssslist


Current Thread