Re: [q-lang-users] "and then" and stack usage
Brought to you by:
agraef
From: ww <wwa...@ea...> - 2004-02-20 04:26:47
|
----- Original Message ----- From: "Albert Graef" <Dr....@t-...> To: <q-l...@li...> Cc: <wwa...@ea...> Sent: Sunday, February 15, 2004 4:10 PM Subject: Re: [q-lang-users] "and then" and stack usage > /me wrote: > > ww wrote: > > > >> I've been exploring Q recently and I've noticed that "and then" doesn't > >> seem to run in constant space. From it's definition (in the docs), I was > >> expecting that it could reuse the stack frame but that doesn't seem to > >> be the case. Am I missing something? > > > > I thought about this problem a little more -- it's really been haunting > > me. ;-) So here's the result of my contemplations... > > > > [snipped] > > I thought about it still some more, and finally decided that this is > really a bug that needs to be solved. Said and done. ;-) So in cvs you > can now find a new version of the interpreter that is fully > tail-recursive. That is, tail calls are now optimized for builtins and > special arguments just as for user-defined rules. Thus, e.g., (=) and > `all' on lists now run in constant stack space, without the need to > rewrite anything. Enjoy! :) > > Albert > > -- > Dr. Albert Gr"af > Email: Dr....@t-..., ag...@mu... > WWW: http://www.musikwissenschaft.uni-mainz.de/~ag Thank you! What a nice surprise. I'll try the new version this weekend. Walt |