diff --git a/gmi.rkt b/gmi.rkt index 30751ed..1148530 100644 --- a/gmi.rkt +++ b/gmi.rkt @@ -156,16 +156,6 @@ (document-items document))) (define (match-link document id) - (define (iter next-structure) - (cond - [(and (link? (car next-structure)) - (= (link-id (car next-structure)) id)) - (link-url (car next-structure))] - - [(empty? (cdr next-structure)) - #f] - - [else - (iter (cdr next-structure))])) - - (iter (document-items document))) + (let ([link (findf (λ (link) (= (link-id link) id)) + (filter link? (document-items document)))]) + (if link (link-url link) #f)))