3
$\begingroup$

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!

$\endgroup$
2
$\begingroup$

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]
  ]]
]
$\endgroup$
  • $\begingroup$ 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! $\endgroup$ – Vazquez Jan 21 '15 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.