On 16-Apr-07, at 6:26 PM, Csaba Henk wrote:
> Hi!Based on the sample code in the concurrency docs, I put together
> this:
>
> !!!!!!!!!!!!!!!!! gentest.factor
> USING: kernel arrays quotations match concurrency math ;
> IN: gentest
>
> : decr-server
> receive {
> {
> { ?from ?tag _ }
> [ 1- dup ?tag swap 2array ?from send decr-server ]
> }
> } match-cond ;
Try putting the recursive call to decr-server after the match-cond.
> Why does that happen, given that Factor features TCO?
Because the recursive call is not a tail call; match-cond is not
calling the quotation in tail position.
The following is a tail call:
: foo ... foo ;
So is this:
: foo ... [ ... foo ] [ ... ] if ;
Because 'if' calls the quotation in tail position.
Slava
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk