March 19th, 2010, 10:55 AM
i've been given an assignment
"define function filter which will act like filter on a list"
which is pretty easy, this is it
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
(define (my_filter p? list)
(if(p? (car list))
(cons (car list) (my_filter p? (cdr list)))
(my_filter p? (cdr list))
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"