22 lines
472 B
Scheme
22 lines
472 B
Scheme
#lang scheme/base
|
|
(provide (all-defined-out))
|
|
|
|
; just some stuff which is probably defined in standard schemish somewhere
|
|
|
|
(define (assoc-remove k l)
|
|
(cond
|
|
((null? l) '())
|
|
((eq? (car (car l)) k)
|
|
(assoc-remove k (cdr l)))
|
|
(else
|
|
(cons (car l) (assoc-remove k (cdr l))))))
|
|
|
|
(define (choose l)
|
|
(list-ref l (random (length l))))
|
|
|
|
(define (list-contains k l)
|
|
(cond
|
|
((null? l) #f)
|
|
((eq? (car l) k) #t)
|
|
(else (list-contains k (cdr l)))))
|
|
|