This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: finite state machines in guile


Tel <telford@eng.uts.edu.au> writes:

 > > There's a C compiler that optimizes tail calls? Where? There is no
 > > requirement in any standard that C prorams should be able to tail-call in
 > > constant space, and I'm not sure if it's even possible with all ABIs..
 > 
 > OK, after experimenting with egcs-1.1b, I'll back off a little. It WILL
 > optimise tail recursion (i.e. the function tail-chaining to itself)
 > but WON'T optimise tail calls (the function tail-chaining to some
 > other function). It won't properly optimise a mutually recursive pair
 > either, even when they are both defined in the same file.

Last time I checked, it won't optimize a fcn tail-calling itself under
certain common conditions either, such as fcns using recursion to walk
a linked list.

In any case, as I said, a) if it's not fully tail recursive it's not
R4RS, and b) C can't be fully tail recursive because of the calling
conventions.

Scheme to C compilers which *are* fully tail recursive (at least
within files, maybe more) are Bigloo & Gambit-C.  Rscheme might be
another one.

-- 
Harvey J. Stein
BFM Financial Research
hjstein@bfr.co.il