I have two lists, list1
and list2
. I want to Select
from list1
using list2
as a comparison standard.
For example:
list1 = {1, 2, 3, 4, 5, 8};
list2 = {3, 5};
Select[list1, (#) < list2[[1]] &]
will give me elements in list1
that is smaller than the 1st element in list2
. I want ot use Map
to get lists of list, each containing sets of elements smaller than 1st, 2nd ..nth elemet of list2
. Basically the results I want is the same as running
{Select[list1, (#) < list2[[1]] &], Select[list1, (#) < list2[[2]] &]}
but I want to use Map
.Then I could not figure out how to get the slots to "find" its appropriate calling function. I was trying something like (Select[list1, #1 < #2 &]) /@ list2
, but it was very obvious it won't work. Any suggestions?