From b66cee04b30328565043ab55d583c0ce863627cf Mon Sep 17 00:00:00 2001 From: "chris.double" Date: Fri, 6 Oct 2006 03:29:50 +0000 Subject: [PATCH] lazy-lists: fix laziness of lappend lappend would evaluate the car of the second list all the time --- contrib/lazy-lists/lists.factor | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/contrib/lazy-lists/lists.factor b/contrib/lazy-lists/lists.factor index 99bc70db8e..4cc9073f30 100644 --- a/contrib/lazy-lists/lists.factor +++ b/contrib/lazy-lists/lists.factor @@ -281,9 +281,7 @@ TUPLE: lazy-append list1 list2 ; : lappend ( list1 list2 -- result ) { - { [ over nil? over nil? and ] [ 2drop nil ] } { [ over nil? ] [ nip ] } - { [ dup nil? ] [ drop ] } { [ t ] [ ] } } cond ; @@ -296,9 +294,9 @@ M: lazy-append cdr ( lazy-append -- cdr ) M: lazy-append nil? ( lazy-append -- bool ) dup lazy-append-list1 nil? [ - drop t + lazy-append-list2 nil? ] [ - lazy-append-list2 nil? + drop f ] if ; M: lazy-append list? ( object -- bool ) -- 2.34.1