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
parent
6cfb951d82
commit
0182a3430d
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue