diff --git a/basis/random/windows/windows.factor b/basis/random/windows/windows.factor index a10f90ddef..30b169bfed 100644 --- a/basis/random/windows/windows.factor +++ b/basis/random/windows/windows.factor @@ -59,11 +59,11 @@ M: windows-rng random-bytes* ( n tuple -- bytes ) [ CryptGenRandom win32-error=0/f ] keep ] with-destructors ; -ERROR: no-windows-crypto-provider ; +ERROR: no-windows-crypto-provider error ; : try-crypto-providers ( seq -- windows-rng ) - [ first2 ] try-find drop - [ no-windows-crypto-provider ] unless* ; + [ first2 ] attempt-all + dup windows-rng? [ no-windows-crypto-provider ] unless ; [ { diff --git a/core/continuations/continuations-docs.factor b/core/continuations/continuations-docs.factor index afe14bf5c6..ac33eee2c5 100644 --- a/core/continuations/continuations-docs.factor +++ b/core/continuations/continuations-docs.factor @@ -48,10 +48,6 @@ $nl recover ignore-errors } -"Word for mapping over a sequence with a quotation until an element doesn't throw an exception:" -{ $subsections - try-find -} "Syntax sugar for defining errors:" { $subsections POSTPONE: ERROR: } "Unhandled errors are reported in the listener and can be debugged using various tools. See " { $link "debugger" } "." @@ -185,10 +181,6 @@ HELP: recover { $values { "try" quotation } { "recovery" { $quotation "( error -- )" } } } { $description "Calls the " { $snippet "try" } " quotation. If an exception is thrown in the dynamic extent of the " { $snippet "try" } " quotation, restores the data stack and calls the " { $snippet "recovery" } " quotation to handle the error." } ; -HELP: try-find -{ $values { "seq" sequence } { "try" quotation } { "result" "the first non-false, non-exception result of the quotation" } { "elt" "the first matching element, or " { $link f } } } -{ $description "Applies the quotation to each element of the sequence, until the quotation outputs a true value, and attempts the next element if an exception is thrown. If the quotation ever yields a result which is not " { $link f } ", then the value is output, along with the element of the sequence which yielded this." } ; - HELP: ignore-errors { $values { "quot" quotation } } { $description "Calls the quotation. If an exception is thrown in the dynamic extent of the quotation, restores the data stack and returns." } ; diff --git a/core/continuations/continuations-tests.factor b/core/continuations/continuations-tests.factor index 5ee61f84d8..0d2880edde 100644 --- a/core/continuations/continuations-tests.factor +++ b/core/continuations/continuations-tests.factor @@ -106,15 +106,3 @@ SYMBOL: error-counter [ { 4 } ] [ { 2 2 } [ + ] with-datastack ] unit-test [ with-datastack ] must-infer - -[ { t 1 } ] -[ { 1 1 } [ odd? ] try-find 2array ] unit-test - -[ { 9 3 } ] -[ { 3 3 } [ sq ] try-find 2array ] unit-test - -[ { f f } ] -[ { 1 1 } [ even? ] try-find 2array ] unit-test - -[ { f f } ] -[ { 1 1 } [ "error" throw ] try-find 2array ] unit-test diff --git a/core/continuations/continuations.factor b/core/continuations/continuations.factor index 9feea46b84..d63acae883 100644 --- a/core/continuations/continuations.factor +++ b/core/continuations/continuations.factor @@ -128,9 +128,6 @@ SYMBOL: thread-error-hook : cleanup ( try cleanup-always cleanup-error -- ) [ compose [ dip rethrow ] curry recover ] [ drop ] 2bi call ; inline -: try-find ( seq try -- result elt ) - [ curry [ drop f ] recover ] curry map-find ; inline - ERROR: attempt-all-error ; : attempt-all ( seq quot -- obj )