MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Undiscovered Bug?

  • To: mathgroup at
  • Subject: [mg46885] Re: Undiscovered Bug?
  • From: lalu_bhatt at (Bhuvanesh)
  • Date: Fri, 12 Mar 2004 23:39:44 -0500 (EST)
  • References: <c2rnrf$p4h$>
  • Sender: owner-wri-mathgroup at

Harold.Noffke at (Harold Noffke) wrote:
> MathGroup:
> In Mathematica 5.0.1 with Windows 2000, I mistakenly used the [[{}]]
> operator on x/y.  I was expecting an error, but I kept getting unusual
> results as shown in In/Out's 2 to 5 below.
> Have I stumbled on a bug, or is there a way to make sense out of this?

This is the expected behavior. Quoting from the RefGuide entry for

expr[[ {i1, i2, ?} ]] gives a list of the parts i1, i2, ?  of expr.
When expr is a list, expr[[ {i1, i2, ?} ]] gives a list of parts. In
general, the head of expr is applied to the list of parts.


In[1]:= expr = a[b,c];

In[2]:= expr[[{0,1,2}]]

Out[2]= a[a, b, c]

In[3]:= Apply[Head[expr], Map[Part[expr,#]&, {0,1,2}]]

Out[3]= a[a, b, c]

Wolfram Research.

Disclaimer: Any opinions expressed herein are my own and not
necessarily those of Wolfram Research.

  • Prev by Date: Re: Undiscovered Bug?
  • Next by Date: Re: Creating a symmetric matrix
  • Previous by thread: Re: Undiscovered Bug?
  • Next by thread: Re: Undiscovered Bug?