1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 ;; about the language level of this file in a form that our tools can easily process.
3 #reader(lib "" "lang")((modname 19.2.1) (read-case-sensitive #t) (teachpacks ((lib "" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "" "teachpack" "htdp")))))
4 ;filter1 : predicate list-of-numbers
5 ;Filters out all numbers in a-lon where the predicate of the number evaluates to false. Retains all numbers that evaluate to true.
6 (define (filter1 predicate a-lon t)
7 (cond
8 [(empty? a-lon) empty]
9 [(predicate (first a-lon) t) (cons (first a-lon)
10 (filter1 predicate (rest a-lon) t))]
11 [else (filter1 predicate (rest a-lon) t)]))