|
|
@ -16,13 +16,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
(define (disjoin . preds) (λ (x) (ormap (λ (pred) (pred x)) preds)))
|
|
|
|
(define (disjoin . preds) (λ (x) (ormap (λ (pred) (pred x)) preds)))
|
|
|
|
(define (conjoin . preds) (λ (x) (andmap (λ (pred) (pred x)) preds)))
|
|
|
|
(define (conjoin . preds) (λ (x) (andmap (λ (pred) (pred x)) preds)))
|
|
|
|
(define identity (λ (x) x))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-generics+provide+safe stringish
|
|
|
|
(define-generics+provide+safe stringish
|
|
|
|
(any/c . -> . string?)
|
|
|
|
(any/c . -> . string?)
|
|
|
|
(->string stringish)
|
|
|
|
(->string stringish)
|
|
|
|
#:fast-defaults
|
|
|
|
#:fast-defaults
|
|
|
|
([string? (define ->string identity)]
|
|
|
|
([string? (define ->string values)]
|
|
|
|
[(disjoin null? void?) (define (->string x) "")]
|
|
|
|
[(disjoin null? void?) (define (->string x) "")]
|
|
|
|
[symbol? (define ->string symbol->string)]
|
|
|
|
[symbol? (define ->string symbol->string)]
|
|
|
|
[number? (define ->string number->string)]
|
|
|
|
[number? (define ->string number->string)]
|
|
|
@ -55,7 +54,7 @@
|
|
|
|
(any/c . -> . symbol?)
|
|
|
|
(any/c . -> . symbol?)
|
|
|
|
(->symbol symbolish)
|
|
|
|
(->symbol symbolish)
|
|
|
|
#:fast-defaults
|
|
|
|
#:fast-defaults
|
|
|
|
([symbol? (define ->symbol identity)]
|
|
|
|
([symbol? (define ->symbol values)]
|
|
|
|
[stringish? (define (->symbol x)
|
|
|
|
[stringish? (define (->symbol x)
|
|
|
|
(with-handlers ([exn:fail? (make-coercion-error-handler ->symbol symbolish? x)])
|
|
|
|
(with-handlers ([exn:fail? (make-coercion-error-handler ->symbol symbolish? x)])
|
|
|
|
(string->symbol (->string x))))]))
|
|
|
|
(string->symbol (->string x))))]))
|
|
|
@ -65,19 +64,18 @@
|
|
|
|
(any/c . -> . path?)
|
|
|
|
(any/c . -> . path?)
|
|
|
|
(->path pathish)
|
|
|
|
(->path pathish)
|
|
|
|
#:fast-defaults
|
|
|
|
#:fast-defaults
|
|
|
|
([path? (define ->path identity)]
|
|
|
|
([path? (define ->path values)]
|
|
|
|
[stringish? (define (->path x)
|
|
|
|
[stringish? (define (->path x)
|
|
|
|
(with-handlers ([exn:fail? (make-coercion-error-handler ->path pathish? x)])
|
|
|
|
(with-handlers ([exn:fail? (make-coercion-error-handler ->path pathish? x)])
|
|
|
|
(if (url? x)
|
|
|
|
(if (url? x)
|
|
|
|
(apply build-path (map path/param-path (url-path x)))
|
|
|
|
(url->path x)
|
|
|
|
(string->path (->string x)))))]))
|
|
|
|
(string->path (->string x)))))]))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-generics+provide+safe urlish
|
|
|
|
(define-generics+provide+safe urlish
|
|
|
|
(any/c . -> . url?)
|
|
|
|
(any/c . -> . url?)
|
|
|
|
(->url urlish)
|
|
|
|
(->url urlish)
|
|
|
|
#:fast-defaults
|
|
|
|
#:fast-defaults
|
|
|
|
([url? (define ->url identity)]
|
|
|
|
([url? (define ->url values)]
|
|
|
|
[stringish? (define (->url x)
|
|
|
|
[stringish? (define (->url x)
|
|
|
|
(with-handlers ([exn:fail? (make-coercion-error-handler ->url urlish? x)])
|
|
|
|
(with-handlers ([exn:fail? (make-coercion-error-handler ->url urlish? x)])
|
|
|
|
(string->url (->string x))))]))
|
|
|
|
(string->url (->string x))))]))
|
|
|
@ -90,7 +88,7 @@
|
|
|
|
([(conjoin path? complete-path?)
|
|
|
|
([(conjoin path? complete-path?)
|
|
|
|
;; caution: plain `complete-path?` returns #t for path strings,
|
|
|
|
;; caution: plain `complete-path?` returns #t for path strings,
|
|
|
|
;; so also check `path?`
|
|
|
|
;; so also check `path?`
|
|
|
|
(define ->complete-path identity)]
|
|
|
|
(define ->complete-path values)]
|
|
|
|
[stringish? (define (->complete-path x)
|
|
|
|
[stringish? (define (->complete-path x)
|
|
|
|
(with-handlers ([exn:fail? (make-coercion-error-handler ->complete-path complete-pathish? x)])
|
|
|
|
(with-handlers ([exn:fail? (make-coercion-error-handler ->complete-path complete-pathish? x)])
|
|
|
|
(path->complete-path (->path x))))]))
|
|
|
|
(path->complete-path (->path x))))]))
|
|
|
@ -100,7 +98,7 @@
|
|
|
|
(any/c . -> . list?)
|
|
|
|
(any/c . -> . list?)
|
|
|
|
(->list listish)
|
|
|
|
(->list listish)
|
|
|
|
#:fast-defaults
|
|
|
|
#:fast-defaults
|
|
|
|
([list? (define ->list identity)]
|
|
|
|
([list? (define ->list values)]
|
|
|
|
[string? (define ->list list)]
|
|
|
|
[string? (define ->list list)]
|
|
|
|
[vector? (define ->list vector->list)]
|
|
|
|
[vector? (define ->list vector->list)]
|
|
|
|
[hash? (define ->list hash->list)]
|
|
|
|
[hash? (define ->list hash->list)]
|
|
|
@ -114,7 +112,7 @@
|
|
|
|
(any/c . -> . vector?)
|
|
|
|
(any/c . -> . vector?)
|
|
|
|
(->vector vectorish)
|
|
|
|
(->vector vectorish)
|
|
|
|
#:fast-defaults
|
|
|
|
#:fast-defaults
|
|
|
|
([vector? (define ->vector identity)]
|
|
|
|
([vector? (define ->vector values)]
|
|
|
|
[listish? (define (->vector x)
|
|
|
|
[listish? (define (->vector x)
|
|
|
|
(with-handlers ([exn:fail? (make-coercion-error-handler ->vector vectorish? x)])
|
|
|
|
(with-handlers ([exn:fail? (make-coercion-error-handler ->vector vectorish? x)])
|
|
|
|
(list->vector (->list x))))]))
|
|
|
|
(list->vector (->list x))))]))
|
|
|
|