Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

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

Search the Archive

Re: Part

  • Subject: [mg2898] Re: [mg2890] Part
  • From: nichols at godel.math.cmu.edu (Preston Nichols)
  • Date: 9 Jan 1996 04:14:46 -0600
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: mj at wri.com

Hans Steffani  wrote:

> w={{1,2,3},{4,5,6},{7,8,9}}
> npos={2,1}
>
> npos is the position of the element I need.
>
> w[[npos]]
>
> does not work, as it returns the second and the first
> line.

Both Dave Wagner[mg2895] and Ross Moore[mg2894] proposed

	w[[Sequence @@ npos]]

as a solution, which looks good to me (except for the usual generic  
misgivings one might have about using an undocumented command such  
as Sequence).

However, my first thought was to use

	w[[##]]& @@ npos

which also seems to work (though it looks dangerously like a  
cartoon expletive).

Can anyone comment on the difference between these?  Are there any  
serious reasons to prefer one over the other, or is it just a matter  
of taste?

Preston Nichols
Department of Mathematics
Carnegie Mellon University



  • Prev by Date: Re: columns
  • Next by Date: Re: columns
  • Previous by thread: Re: Part
  • Next by thread: Re: Part