MathGroup Archive 1996

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

Search the Archive

Re: Part


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