Clarify error message

This commit is contained in:
Lassi Kortela 2021-07-20 17:20:36 +03:00
parent 1042daa7ca
commit 0f87d39e37
1 changed files with 4 additions and 2 deletions

View File

@ -32,15 +32,17 @@
(define (group-file head filename) (define (group-file head filename)
(group head (with-input-from-file filename read-all))) (group head (with-input-from-file filename read-all)))
(define (no-key key) (error "No key:" key))
(define (assoc? key alist) (define (assoc? key alist)
(let ((x (assoc key alist))) (let ((x (assoc key alist)))
(cond ((not x) #f) (cond ((not x) #f)
((and (list? x) (= 2 (length x))) (cadr x)) ((and (list? x) (= 2 (length x))) (cadr x))
(else (error "Nope"))))) (else (no-key key)))))
(define (assoc1 key alist) (define (assoc1 key alist)
(let ((x (assoc key alist))) (let ((x (assoc key alist)))
(if (and (list? x) (= 2 (length x))) (cadr x) (error "Nope")))) (if (and (list? x) (= 2 (length x))) (cadr x) (no-key key))))
(define (superscripts s) (define (superscripts s)
(let ((n (string-length s))) (let ((n (string-length s)))