Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

Topic: bug or feature ?
Replies: 3   Last Post: Jun 25, 2013 2:54 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Sseziwa Mukasa

Posts: 108
Registered: 8/26/07
Re: bug or feature ?
Posted: Jun 24, 2013 3:52 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


Position checks the heads of expressions too, try

(Debug) In[7]:= Position[{{1, 2}, {2, 3}, {1,
4}}, _?(EvenQ[#[[2]]] &), {1}, Heads -> False]

(Debug) Out[7]= {{1}, {3}}


On Sun, Jun 23, 2013 at 10:57 PM, roby <roby.nowak@gmail.com> wrote:

> Dear Group
>
> When trying to evaluate the following code the expected result is returned.
> But strangly there is an error message generated.
> The code should (and does) return the positions of all sublists with an
> even element at the second position.
>
>
>
> Position[{{1, 2}, {2, 3}, {1, 4}}, _?(EvenQ[#[[2]]] &), {1}]
>
> Part::partd: Part specification List[[2]] is longer than depth of object.

> >>
>
> {{1}, {3}}
>
>
>
> Any hints if this a bug or a feature ?
>
> Regards Robert
>
>





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.