
March 19th, 2010, 10:55 AM
|
|
Registered User
|
|
Join Date: Mar 2010
Posts: 1
Time spent in forums: 26 m 11 sec
Reputation Power: 0
|
|
|
Homework - Lisp/scheme, filter
hello,
i've been given an assignment
"define function filter which will act like filter on a list"
which is pretty easy, this is it
Code:
(define (my_filter p? list)
(if(null? list)
nil
(if(p? (car list))
(cons (car list) (my_filter p? (cdr list)))
(my_filter p? (cdr list))
)
)
)
but the second part says "do so using functions map, append and apply" and i really don't understand how he wants me to define filter using those functions
the closest i got was mapping the list and returning either empty list or the original element, but that still leaves the empty lists instead of "nothing"
|