MathGroup Archive 1996

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

Search the Archive

Re: Part

  • Subject: [mg2894] Re: [mg2890] Part
  • From: ross at zeus.mpce.mq.edu.au ("Ross Moore <ross at zeus.mpce.mq.edu.au>")
  • Date: 5 Jan 1996 03:50:39 -0600
  • Approved: usenet@wri.com
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Wolfram Research, Inc.
  • Sender: mj at wri.com


Hello Hans,

> 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.


No, ...and neither should it, 
since the argument is a List of integers, not a Sequence.

You want:   
	w[[Apply[Sequence,npos]]]  

or its shorthand   
	w[[Sequence@@npos]]  
e.g.

(Zeus2.2.2) In[8]:= w[[Sequence@@npos]]
(Zeus2.2.2) Out[8]= 4


Regards,

	Ross

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ross Moore                         Internet: ross at mpce.mq.edu.au
Mathematics Department                Work:       +61 2 850-8955
Macquarie University                   Home:   please do not try
North Ryde, Sydney                     Fax:       +61 2 850-8114
Australia  2109			http://www.mpce.mq.edu.au/~ross/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


  • Prev by Date: Re: Part
  • Next by Date: Re: Re: Problems with Outer
  • Previous by thread: Re: Part
  • Next by thread: Re: Part