From 4cf362222e1cf870efe3b643d2ed5e5114f6db31 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Fri, 25 Jul 2014 10:57:17 -0700 Subject: [PATCH] remove use of 'try' --- pagetree.rkt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pagetree.rkt b/pagetree.rkt index 8e7ec0e..d5ca241 100644 --- a/pagetree.rkt +++ b/pagetree.rkt @@ -7,13 +7,13 @@ (define+provide (pagenode? x) - (->boolean (and (symbol? x) (try (not (whitespace/nbsp? (->string x))) - (except [exn:fail? (λ(e) #f)]))))) + (->boolean (and (symbol? x) (with-handlers ([exn:fail? (λ(e) #f)]) + (not (whitespace/nbsp? (->string x))))))) (define+provide (pagenodeish? x) - (try (pagenode? (->symbol x)) - (except [exn:fail? (λ(e) #f)]))) + (with-handlers ([exn:fail? (λ(e) #f)]) + (pagenode? (->symbol x)))) (define/contract+provide (->pagenode x) @@ -34,14 +34,14 @@ (let ([pagenodes (pagetree->list x)]) (and (andmap (λ(p) (or (pagenode? p) (error (format "validate-pagetree: \"~a\" is not a valid pagenode" p)))) pagenodes) - (try (members-unique?/error pagenodes) - (except [exn:fail? (λ(e) (error (format "validate-pagetree: ~a" (exn-message e))))])) + (with-handlers ([exn:fail? (λ(e) (error (format "validate-pagetree: ~a" (exn-message e))))]) + (members-unique?/error pagenodes)) x)))) (define+provide (pagetree? x) - (try (->boolean (validate-pagetree x)) - (except [exn:fail? (λ(e) #f)]))) + (with-handlers ([exn:fail? (λ(e) #f)]) + (->boolean (validate-pagetree x)))) (define+provide/contract (directory->pagetree dir)