]> gitweb.factorcode.org Git - factor.git/commitdiff
Remove silly retry word from continuations vocab
authorSlava Pestov <slava@shill.internal.stack-effects.com>
Fri, 8 May 2009 05:20:54 +0000 (00:20 -0500)
committerSlava Pestov <slava@shill.internal.stack-effects.com>
Fri, 8 May 2009 05:20:54 +0000 (00:20 -0500)
basis/io/files/unique/unique.factor
core/continuations/continuations-docs.factor
core/continuations/continuations.factor
extra/webapps/wee-url/wee-url.factor

index 0e4338e3e0415d37a530e5a3d74da5c2de9e477d..a7ae317668bd1a01790821e4bb35a1e52b062a20 100644 (file)
@@ -35,6 +35,9 @@ SYMBOL: unique-retries
 : random-name ( -- string )
     unique-length get [ random-ch ] "" replicate-as ;
 
+: retry ( quot: ( -- ? )  n -- )
+    swap [ drop ] prepose attempt-all ; inline
+
 : (make-unique-file) ( path prefix suffix -- path )
     '[
         _ _ _ random-name glue append-path
index 2c91981f1362c2ad554ce296d404458debfd8cc2..fa8ecbe385dfd03b45a73d8ed7c9b85b53f5b0db 100644 (file)
@@ -79,7 +79,6 @@ $nl
 { $subsection continue-with }
 "Continuations as control-flow:"
 { $subsection attempt-all }
-{ $subsection retry }
 { $subsection with-return }
 "Continuations serve as the building block for a number of higher-level abstractions, such as " { $link "errors" } " and " { $link "threads" } "."
 { $subsection "continuations.private" } ;
@@ -232,21 +231,6 @@ HELP: attempt-all
     }
 } ;
 
-HELP: retry
-{ $values
-     { "quot" quotation } { "n" integer }
-}
-{ $description "Tries the quotation up to " { $snippet "n" } " times until it returns true. Retries the quotation if an exception is thrown or if the quotation returns " { $link f } ". The quotation is expected to have side effects that may fail, such as generating a random name for a new file until successful." }
-{ $examples
-    "Try to get a 0 as a random number:"
-    { $unchecked-example "USING: continuations math prettyprint random ;"
-        "[ 5 random 0 = ] 5 retry"
-        "t"
-    }
-} ;
-
-{ attempt-all retry } related-words
-
 HELP: return
 { $description "Returns early from a quotation by reifying the continuation captured by " { $link with-return } " ; execution is resumed starting immediately after " { $link with-return } "." } ;
 
index 56ac4a71e9721b678d38790992ea725f082a2152..7681c2b089f5543acf06398de31932ba82384906 100644 (file)
@@ -155,8 +155,6 @@ ERROR: attempt-all-error ;
         ] { } make peek swap [ rethrow ] when
     ] if ; inline
 
-: retry ( quot: ( -- ? )  n -- ) swap [ drop ] prepose attempt-all ; inline
-
 TUPLE: condition error restarts continuation ;
 
 C: <condition> condition ( error restarts cc -- condition )
index bc429a0af6d8a8f4b5bdefca0b9cd38b975b0060..8e200a44527bf0b2873c74717b4a2de5a3cd7b15 100644 (file)
@@ -26,6 +26,9 @@ short-url "SHORT_URLS" {
 : random-url ( -- string )
     1 6 [a,b] random [ letter-bank random ] "" replicate-as ;
 
+: retry ( quot: ( -- ? )  n -- )
+    swap [ drop ] prepose attempt-all ; inline
+
 : insert-short-url ( short-url -- short-url )
     '[ _ dup random-url >>short insert-tuple ] 10 retry ;