]> gitweb.factorcode.org Git - factor.git/commitdiff
Fixing implementation of leach
authorJames Cash <james.nvc@gmail.com>
Wed, 4 Jun 2008 04:02:29 +0000 (00:02 -0400)
committerJames Cash <james.nvc@gmail.com>
Wed, 4 Jun 2008 04:02:29 +0000 (00:02 -0400)
extra/lists/lists.factor

index b7e5e6523fa5f69350e6116da6ddd73a5da36924..f9b7b89e5b69588afa6c3e14642ba114bc471967 100644 (file)
@@ -54,11 +54,10 @@ M: cons nil? ( cons -- ? )
     0 (llength) ;
 
 : leach ( list quot -- )
-    over nil? [ 2drop ] [ [ uncons ] dip tuck call leach ] if ; inline
+    over nil? [ 2drop ] [ [ uncons swap ] dip tuck [ call ] 2dip leach ] if ; inline
     
 : lreduce ( list identity quot -- result )
-    pick nil? [ drop nip ]
-    [ [ uncons ] 2dip swapd [ call ] keep lreduce ] if ; inline
+    swapd leach ; inline
     
 : (lmap) ( acc cons quot -- seq )    
     over nil? [ 2drop ]