]> gitweb.factorcode.org Git - factor.git/commitdiff
circular: rename circular-while* to circular-loop, add some docs.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 6 Sep 2013 17:16:20 +0000 (10:16 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 6 Sep 2013 17:16:20 +0000 (10:16 -0700)
basis/circular/circular-docs.factor
basis/circular/circular-tests.factor
basis/circular/circular.factor

index 13934a1f91230bb3450cb1df6089ab61250862cb..9dcf4817ce7967ce29eb72e77d8410ee52eb4a6f 100644 (file)
@@ -55,12 +55,13 @@ HELP: circular-while
 }
 { $description "Calls " { $snippet "quot" } " on each element of the sequence until each call yields " { $link f } " in succession." } ;
 
-HELP: circular-while*
+HELP: circular-loop
 { $values
     { "circular" circular }
     { "quot" quotation }
 }
-{ $description "Calls " { $snippet "quot" } " on each element of the sequence until one call yields " { $link f } "." } ;
+{ $description "Calls " { $snippet "quot" } " on each element of the sequence until one call yields " { $link f } "." }
+{ $notes "This rotates the " { $link circular } " object after each call, so the next element to be applied will always be the first element." } ;
 
 ARTICLE: "circular" "Circular sequences"
 "The " { $vocab-link "circular" } " vocabulary implements the " { $link "sequence-protocol" } " to allow an arbitrary start index and wrap-around indexing." $nl
@@ -81,6 +82,6 @@ ARTICLE: "circular" "Circular sequences"
     growing-circular-push
 }
 "Iterating over a circular until a stop condition:"
-{ $subsections circular-while circular-while* } ;
+{ $subsections circular-while circular-loop } ;
 
 ABOUT: "circular"
index 4dfc88f521754e565c69a4153ce58fa374d725f3..c83d4eb8973d9ed4fe2352492108065f5c0e14b6 100644 (file)
@@ -65,12 +65,12 @@ CONSTANT: test-sequence2 { t f t t f f t t t f f f }
 
 [ V{ 1 2 3 1 2 } ] [
     { 1 2 3 } <circular> V{ } [
-        [ [ push ] [ length 5 < ] bi ] curry circular-while*
+        [ [ push ] [ length 5 < ] bi ] curry circular-loop
     ] keep
 ] unit-test
 
 [ V{ 1 } ] [
     { 1 2 3 } <circular> V{ } [
-        [ push f ] curry circular-while*
+        [ push f ] curry circular-loop
     ] keep
 ] unit-test
index c06e5ca531c30c93d4f8d0f7f46879728716534a..a59e468dd0fcef5f966b378b689e5893fceda6ac 100644 (file)
@@ -78,5 +78,5 @@ PRIVATE>
 : circular-while ( ... circular quot: ( ... obj -- ... ? ) -- ... )
     [ clone ] dip [ <circular-iterator> ] dip (circular-while) ; inline
 
-: circular-while* ( ... circular quot: ( ... obj -- ... ? ) -- ... )
+: circular-loop ( ... circular quot: ( ... obj -- ... ? ) -- ... )
   [ clone ] dip '[ [ first @ ] [ rotate-circular ] bi ] curry loop ; inline