I can not figure it out.
Why does Position only uses patterns to match elements in a list, but Select only uses pure function to test element in a list?
|
I can not figure it out. Why does |
||||
| show 6 more comments |
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.
Position[Range[0, 10], _?(Divisible[#, 5] &)]– belisarius Mar 7 at 12:38Selectuse patterns? – matheorem Mar 7 at 13:25Cases. Also, this question seems directly relevant. – Leonid Shifrin Mar 7 at 13:36Selectcomes from a data-processing world and is closer to the functionality present in more traditional languages, whilePositionandCasesare tools to work with symbolic Mathematica expressions, based on the pattern-matching. They are more general, and well-suited for general expression traversals, whileSelectis better optimized to work with structured data such as packed arrays. Both are useful in different situations. I think that in my answer in the question I linked I described this distinction better. – Leonid Shifrin Mar 7 at 13:53