Name: Anonymous 2012-12-02 15:29
Does anyone know how to do this using one of these: filter, map, foldr? We're not allowed to use recursion.
Write a Scheme function find-common (using at least one abstract list function), which consumes two lists of numbers lst1, and lst2 and produces a list of all elements of lst1 that appear in lst2, with the same order of lst1 . Some examples follow:
(find-common empty empty) => empty
(find-common (list 2 3 56 23 3) (list 3 2 4 56 4 14)) => (list 2 3 56 3)
(find-common (list 56 29) (list 156 329 43)) => empty
Write a Scheme function find-common (using at least one abstract list function), which consumes two lists of numbers lst1, and lst2 and produces a list of all elements of lst1 that appear in lst2, with the same order of lst1 . Some examples follow:
(find-common empty empty) => empty
(find-common (list 2 3 56 23 3) (list 3 2 4 56 4 14)) => (list 2 3 56 3)
(find-common (list 56 29) (list 156 329 43)) => empty