From 0182a3430d00a2746fdd577b3d2345ea6b8b5c5b Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Sat, 27 Dec 2008 21:39:32 +0100 Subject: [PATCH] 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. --- core/sequences/sequences.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor index 31c7c8a4d7..40a8892e8b 100644 --- a/core/sequences/sequences.factor +++ b/core/sequences/sequences.factor @@ -828,7 +828,7 @@ PRIVATE> : 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