Subject: Re: processing character entities From: Chris Maden <crism@xxxxxxxxxxx> Date: Tue, 27 Jul 1999 13:44:30 -0400 (EDT) |
I do not understand this whole tail-recursion thing. I *thought* I did, but Brandon's post indicates otherwise. I had a loop of the form: (let loop ((init value)) (if loop-is-done null-object (append-objects this-one (loop change-value)))) I thought the key feature of tail recursion was that the recursive call was the last thing in the loop. In fact, I've been pretty careful to write most or all of my loops with this form. However, Brandon suggests a loop of the form: (let loop ((init value) (result empty-object) (if loop-is-done result (loop change-value (append-objects result this-one))))) So what, exactly, is the defining feature of tail recursion? It seems to me that the second form involves passing a larger and larger result object into the recursion, possibly with a new copy each time. Now, I can see how that won't happen if the loop's execution is optimized, but I am really an assembly programmer in disguise, and don't like to assume magical optimization by some other entity. If someone can assure me that this is, indeed, The Lisp Way (preferably with an explanation of why), I'll deal with it, but I'd like to understand what's going on before I re-write a whole lot of code. Thanks in advance, Chris -- <!NOTATION SGML.Geek PUBLIC "-//Anonymous//NOTATION SGML Geek//EN"> <!ENTITY crism PUBLIC "-//O'Reilly//NONSGML Christopher R. Maden//EN" "<URL>http://www.oreilly.com/people/staff/crism/ <TEL>+1.617.499.7487 <USMAIL>90 Sherman Street, Cambridge, MA 02140 USA" NDATA SGML.Geek> DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: processing character entities, Alexander Taranov | Thread | Re: processing character entities, David Carlisle |
Again with the System Identifiers, Chris Maden | Date | If statement question, Darrell W. Royter |
Month |