;;;; condition-utils.inline.scm -*- Scheme -*- ;;;; Kon Lovett, Jan '25 (define-type condition-predicate (* -> boolean : condition)) (define-type condition-property-accessor (condition -> *)) ;NOTE really on1st/1! #; (define-syntax on1st (syntax-rules () ((on1st ?typ ?e0 ...) (let ((+proc+ (the (or false ?typ) #f))) (lambda (x) (unless +proc+ (set! +proc+ (begin ?e0 ...))) (+proc+ x)) ) ) ) ) (define-syntax on1st (syntax-rules () ((on1st ?nam ?typ ?e0 ...) (begin (: ?nam ?typ) (let ((+proc+ (the (or false ?typ) #f))) (lambda (x) (unless +proc+ (let ((+proc+ (begin ?e0 ...))) (set! ?nam +proc+) (+proc+ x)) ) ) ) ) ) ) ) (define-syntax define-condition-predicate (syntax-rules () ((define-condition-predicate ?nam ?d0 ...) (define ?nam (on1st ?nam condition-predicate (make-condition-predicate ?d0 ...))) ) ) ) (define-syntax define-condition-property-accessor (syntax-rules () ((define-condition-property-accessor ?nam ?d0 ...) (define ?nam (on1st ?nam condition-property-accessor (make-condition-property-accessor ?d0 ...))) ) ) )