Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15001
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit4.readnews.com!newspump.sol.net!posts.news.twtelecom.net!nnrp3.twtelecom.net!not-for-mail |
|---|---|
| From | Daniel <dosadchy@its.jnj.com> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Position[] bug or feature ? |
| Date | Tue, 25 Jun 2013 06:53:33 +0000 (UTC) |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <kqbepd$fog$1@smc.vnet.net> (permalink) |
| Lines | 32 |
| Organization | Time-Warner Telecom |
| NNTP-Posting-Date | 25 Jun 2013 06:55:24 GMT |
| NNTP-Posting-Host | 91d1c403.news.twtelecom.net |
| X-Trace | DXC=<>gcn=E@]m?8mB8O8Rk7=0C_A=>8kQj6=MOj3YM9`=a8`b?ZMR81nR4EFiONJ7[Go6IR9JS6Vb2c5 |
| X-Complaints-To | abuse@twtelecom.net |
| Xref | csiph.com comp.soft-sys.math.mathematica:15001 |
Show key headers only | View raw
> 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
>
Expression head is also on level 1, and the Position[] function includes heads in the search by default. And obviously, when trying to check the head "List", it cannot calculate EvenQ[List[[2]]]
This works:
Position[{{1, 2}, {2, 3}, {1, 4}}, _?(EvenQ[#[[2]]] &), {1}, Heads -> False]
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar
Re: Position[] bug or feature ? Daniel <dosadchy@its.jnj.com> - 2013-06-25 06:53 +0000
csiph-web