]> gitweb.factorcode.org Git - factor.git/commitdiff
Move heap-slurp-when to spider
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 2 Oct 2008 01:54:58 +0000 (20:54 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 2 Oct 2008 01:54:58 +0000 (20:54 -0500)
basis/heaps/heaps-docs.factor
basis/heaps/heaps.factor
extra/spider/spider-docs.factor
extra/spider/spider.factor

index 90298c6edfb17f19f28ed5629ce85fc0e03c962b..77537cbfb1300b3c17726f728c6418d1155a31ae 100755 (executable)
@@ -91,8 +91,3 @@ HELP: slurp-heap
 { $values
      { "heap" "a heap" } { "quot" quotation } }
 { $description "Removes values from a heap and processes them with the quotation until the heap is empty." } ;
-
-HELP: slurp-heap-when
-{ $values
-     { "heap" "a heap" } { "quot1" quotation } { "quot2" quotation } }
-{ $description "Removes values from a heap that match the predicate quotation " { $snippet "quot1" } " and processes them with " { $snippet "quot2" } " until the predicate quotation no longer matches." } ;
index 50aad826f5b96821462ce559dd4818a13f940a3a..6c387632ed526e202e9d6fbfb855ca2842cabfe5 100755 (executable)
@@ -195,9 +195,3 @@ M: heap heap-pop ( heap -- value key )
     over heap-empty? [ 2drop ] [
         [ [ heap-pop drop ] dip call ] [ slurp-heap ] 2bi
     ] if ; inline recursive
-
-: slurp-heap-when ( heap quot1 quot2: ( value key -- ) -- )
-    pick heap-empty? [ 3drop ] [
-        [ [ heap-pop dup ] 2dip slip [ t ] compose [ 2drop f ] if ]
-        [ roll [ slurp-heap-when ] [ 3drop ] if ] 3bi
-    ] if ; inline recursive
index 27238e4f1978ec784b79b9a606760141d084675f..458c1d14d8c0af03d621b1b097b54de6a1eb9d43 100644 (file)
@@ -22,6 +22,11 @@ HELP: spider
 HELP: spider-result
 { $description "" } ;
 
+HELP: slurp-heap-when
+{ $values
+     { "heap" "a heap" } { "quot1" quotation } { "quot2" quotation } }
+{ $description "Removes values from a heap that match the predicate quotation " { $snippet "quot1" } " and processes them with " { $snippet "quot2" } " until the predicate quotation no longer matches." } ;
+
 ARTICLE: "spider-tutorial" "Spider tutorial"
 "To create a new spider, call the " { $link <spider> } " word with a link to the site you wish to spider."
 { $code <" "http://concatentative.org" <spider> "> }
index 6f5261f158307ad7fcca7c26e8a6555911b9a769..8f60a0d521d60c94e9abf29a73b70d1b77d764bc 100644 (file)
@@ -81,6 +81,12 @@ links processing-time timestamp ;
     [ initial-links>> normalize-hrefs 0 ] keep
     [ add-todo ] keep ;
 
+: slurp-heap-when ( heap quot1 quot2: ( value key -- ) -- )
+    pick heap-empty? [ 3drop ] [
+        [ [ heap-pop dup ] 2dip slip [ t ] compose [ 2drop f ] if ]
+        [ roll [ slurp-heap-when ] [ 3drop ] if ] 3bi
+    ] if ; inline recursive
+
 PRIVATE>
 
 : run-spider ( spider -- spider )