Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
1  
Position[Range[0, 10], _?(Divisible[#, 5] &)] – belisarius Mar 7 at 12:38
@belisarius Thank you, belisarius. Can Select use patterns? – matheorem Mar 7 at 13:25
1  
If you want to select elements based on patterns, you may be better off with Cases. Also, this question seems directly relevant. – Leonid Shifrin Mar 7 at 13:36
1  
@LeonidShifrin I think the OP is more interested in the language design decision. I don't have any input for that. – belisarius Mar 7 at 13:40
4  
@belisarius My understanding is that Select comes from a data-processing world and is closer to the functionality present in more traditional languages, while Position and Cases are tools to work with symbolic Mathematica expressions, based on the pattern-matching. They are more general, and well-suited for general expression traversals, while Select is 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
show 6 more comments

closed as not a real question by Szabolcs, Oleksandr R., Sjoerd C. de Vries, rcollyer, acl Mar 8 at 1:33

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.

Browse other questions tagged or ask your own question.