summaryrefslogtreecommitdiff
path: root/util/alist.scm
blob: 6bc0bdae3ea1070e9fab4bfe75f45573c1ca6144 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
(define-module (util/alist)
               #: export (lookup-assoc-list
                           is-elem-assoc-list))

(define (is-elem-assoc-list key assoc-list)
  (cond
    [(null? assoc-list) #f]
    [(eq? key (caar assoc-list)) #t]
    [else (lookup-assoc-list key (cdr assoc-list))]))

(define (lookup-assoc-list key assoc-list)
  (cond
    [(null? assoc-list) #f]
    [(eq? key (caar assoc-list)) (cdar assoc-list)]
    [else (lookup-assoc-list key (cdr assoc-list))]))