blob: be83967d9f8305f1d3ab260a39947d11aff76564 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
;;;;; cs60a/lectures/1.3/keep.scm
(define (evens nums)
(cond ((empty? nums) '())
((= (remainder (first nums) 2) 0)
(se (first nums) (evens (bf nums))) )
(else (evens (bf nums))) ))
(define (ewords sent)
(cond ((empty? sent) '())
((member? 'e (first sent))
(se (first sent) (ewords (bf sent))) )
(else (ewords (bf sent))) ))
(define (pronouns sent)
(cond ((empty? sent) '())
((member? (first sent) '(I me you he she it him her we us they them))
(se (first sent) (pronouns (bf sent))) )
(else (pronouns (bf sent))) ))
(define (keep pred sent)
(cond((empty? sent) '())
((pred (first sent))(se (first sent)(keep pred (bf sent))))
(else (keep pred (bf sent)))))
|