Allow sigma and friends to use the stack

"sigma" used to use the stack to remember the current total.
This prevented the use of quotations manipulating elements
that were expecting to be on the stack.

This patch hides the counter while executing the quotation,
so that the latter can fully use the stack.
db4
Samuel Tardieu 2008-12-27 21:39:32 +01:00
parent 6cfb951d82
commit 0182a3430d
1 changed files with 1 additions and 1 deletions

View File

@ -828,7 +828,7 @@ PRIVATE>
: supremum ( seq -- n ) dup first [ max ] reduce ; : supremum ( seq -- n ) dup first [ max ] reduce ;
: sigma ( seq quot -- n ) [ + ] compose 0 swap reduce ; inline : sigma ( seq quot -- n ) 0 -rot [ rot slip + ] curry each ; inline
: count ( seq quot -- n ) [ 1 0 ? ] compose sigma ; inline : count ( seq quot -- n ) [ 1 0 ? ] compose sigma ; inline