5

I want to select certain rows from a list by using two nested Select commands

Select[List1, #[[2]] >= 
   Select[List2, #[[1]] == IntegerPart[2* PREVIOUS#[[1]] ]/2 &] &]

where by PREVIOUS#[[1]] I mean the first argument of the previous pure function (i.e. the argument of the list List1). I think this question may be duplicated, since I found that people solves this kind of problems using Function[], but I cannot figure out how (Sorry for my ignorance, I am new in Mathematica).

Cheers!

Vazquez
  • 361
  • 1
  • 7

1 Answers1

4

Using Function you can give the parameters a name:

Select[
  List1, 
  Function[a, a[[2]] >= Select[
    List2, 
    Function[b, b[[1]] == IntegerPart[2*a[[1]]]/2]
  ]]
]
Martin Ender
  • 8,774
  • 1
  • 34
  • 60
  • Thank you very much for that, I was not sure whether using "Function[]" and the "&" notation was exactly equivalent. And again, sorry for my stupid question! – Vazquez Jan 21 '15 at 14:54