From 410a71f677ab907da33315ac07cbb5bc6ac2ae5e Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Fri, 6 Sep 2013 10:16:20 -0700 Subject: [PATCH] circular: rename circular-while* to circular-loop, add some docs. --- basis/circular/circular-docs.factor | 7 ++++--- basis/circular/circular-tests.factor | 4 ++-- basis/circular/circular.factor | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/basis/circular/circular-docs.factor b/basis/circular/circular-docs.factor index 13934a1f91..9dcf4817ce 100644 --- a/basis/circular/circular-docs.factor +++ b/basis/circular/circular-docs.factor @@ -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" diff --git a/basis/circular/circular-tests.factor b/basis/circular/circular-tests.factor index 4dfc88f521..c83d4eb897 100644 --- a/basis/circular/circular-tests.factor +++ b/basis/circular/circular-tests.factor @@ -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 } V{ } [ - [ [ push ] [ length 5 < ] bi ] curry circular-while* + [ [ push ] [ length 5 < ] bi ] curry circular-loop ] keep ] unit-test [ V{ 1 } ] [ { 1 2 3 } V{ } [ - [ push f ] curry circular-while* + [ push f ] curry circular-loop ] keep ] unit-test diff --git a/basis/circular/circular.factor b/basis/circular/circular.factor index c06e5ca531..a59e468dd0 100644 --- a/basis/circular/circular.factor +++ b/basis/circular/circular.factor @@ -78,5 +78,5 @@ PRIVATE> : circular-while ( ... circular quot: ( ... obj -- ... ? ) -- ... ) [ clone ] dip [ ] dip (circular-while) ; inline -: circular-while* ( ... circular quot: ( ... obj -- ... ? ) -- ... ) +: circular-loop ( ... circular quot: ( ... obj -- ... ? ) -- ... ) [ clone ] dip '[ [ first @ ] [ rotate-circular ] bi ] curry loop ; inline