From fbfa1f8de9be31a410ef4a6293c60fdbfb863914 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 28 Feb 2008 15:42:34 -0600 Subject: [PATCH] add retry combinator to combinators.lib --- extra/combinators/lib/lib.factor | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extra/combinators/lib/lib.factor b/extra/combinators/lib/lib.factor index 9ccada1ec1..019f4fe376 100755 --- a/extra/combinators/lib/lib.factor +++ b/extra/combinators/lib/lib.factor @@ -3,7 +3,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel combinators namespaces quotations hashtables sequences assocs arrays inference effects math math.ranges -arrays.lib shuffle macros bake combinators.cleave ; +arrays.lib shuffle macros bake combinators.cleave +continuations ; IN: combinators.lib @@ -167,3 +168,6 @@ MACRO: construct-slots ( assoc tuple-class -- tuple ) : and? ( obj quot1 quot2 -- ? ) >r keep r> rot [ call ] [ 2drop f ] if ; inline + +: retry ( quot n -- ) + swap [ drop ] swap compose attempt-all ;