I have several lists of tuples in the following shape:
l1 = {{1, 134}, {2, 314}, {3, 164}}
I do want to select, from each list, list elements fulfilling a certain criteria. I am using the following pure function for this (applied here to my first list):
In[508]:= Select[l1, #[[1]] > 2 &]
Out[508]= {{3, 164}}
How can I apply this function to several lists at the same time?
Silly question first: how would you best describe this task? That might help me searching for it in the forums. So far I found no good way of doing it (or possibly have simply not understood it if I came across it).
I would be grateful if anyone could point me the right way. I find the pure function annotation a bit confusing still, so any help is greatly appreciated.
thanks!
mondo
Edit addressing Szabolcs' comment: I do have a solution to filter a single list. I want to filter through all my lists though, without having to apply a for loop (if possible).
Map
, perhaps? (UseMap
to applySelect
to each list in your list of lists.Select
does not have a level specification, so you can't do it without some sort of loop. Maybe some don't think ofMap
as a loop.) $\endgroup$