5
$\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$
0

1 Answer 1

4
$\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$
1
  • $\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
    Commented Jan 21, 2015 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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