MathGroup Archive 1996

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

Search the Archive

Re: Part

  • To: mathgroup at smc.vnet.net
  • Subject: [mg2897] Re: Part
  • From: Jorma Virtamo <jorma.virtamo at vtt.fi>
  • Date: Tue, 9 Jan 1996 02:16:14 -0500

wagner at bullwinkle.cs.Colorado.EDU (Dave Wagner) wrote:
>In article <4cgrsc$im4 at dragonfly.wri.com>,
>Hans Steffani <hans.steffani at e-technik.tu-chemnitz.de> 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.
>
>This same question came up a couple of weeks ago.  You want
>to use:
>
>	w[[Sequence @@ npos]]
>
>Sequence is an undocumented function that obliterates the head
>of whatever it is applied to.  In this case, it obliterates the
>List wrapper, leaving a sequence of two integers.
>

Alternatively, one can write without using an undocumented function:

  w[[##]]& @@ npos


-- Jorma Virtamo

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jorma Virtamo                      VTT Information Technology
phone: +358 0 456 5612             Telecommunications
fax:   +358 0 455 0115             P.O. Box 1202  
email: jorma.virtamo at vtt.fi        FIN-02044 VTT                        
web:   http://www.vtt.fi/tte/      Finland


==== [MESSAGE SEPARATOR] ====


  • Prev by Date: M-ma speed under Windows 95
  • Next by Date: Mathematica Plots -> Editing using Canvas or Illustrator ?
  • Previous by thread: Re: Part
  • Next by thread: Re: Part