From 858237c0f879acc362805822f1f850c0e2646f25 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Fri, 21 Dec 2007 05:42:25 +0100 Subject: [PATCH] Reimplement leach so that stack is clean when executing the quotation The previous implementation let garbage on the stack (such as the lazy list cdr) before executing the quotation. This prevents easy implementation of reduce-like words using leach. --- extra/lazy-lists/lazy-lists.factor | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/extra/lazy-lists/lazy-lists.factor b/extra/lazy-lists/lazy-lists.factor index 2e3dc9154a..c629408704 100644 --- a/extra/lazy-lists/lazy-lists.factor +++ b/extra/lazy-lists/lazy-lists.factor @@ -100,11 +100,7 @@ M: lazy-cons list? ( object -- bool ) dup car swap cdr ; : leach ( list quot -- ) - swap dup nil? [ - 2drop - ] [ - uncons swap pick call swap leach - ] if ; + swap dup nil? [ 2drop ] [ uncons swapd over 2slip leach ] if ; inline TUPLE: memoized-cons original car cdr nil? ;