MathGroup Archive 1994

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

Search the Archive

Re: Taking brackets off lists

  • To: mathgroup at
  • Subject: [mg291] Re: [mg281] Taking brackets off lists
  • From: Xah Y Lee <xyl10060 at>
  • Date: Mon, 5 Dec 1994 22:29:51 -0800 (PST)

On Sun, 4 Dec 1994, corcoran wrote:

> If I have a list like,
> list = {1,1,1,2}
> how do I find the part of a expression at the level specified by the list?
> i.e.
> I want exp[[1,1,1,2]],
> but exp[[list]] doesn't work.
> Thanks,
> Stephen

mylist = {1,1,1,2};

expr = Table[Random[Integer,{0,10}],{3},{2},{3},{3}];



Part[expr, Sequence@@mylist ]

will give you what you want. Sequence[] is not documented. In general, 
f[Sequence[x1,x2,...,xn]] will evaluate to f[x1,x2,...,xn].

Reference: _Programming in Mma_ by Roman Maeder.
Also mentioned in _Mma Quick Ref. v2_ by Nancy Blachman.

Mountain View, CA
temporary email: xyl10060 at
permament email: 74631.731 at

  • Prev by Date: Pentium timings
  • Next by Date: R.E. Troubles with calculations using HP-UX notebook interface
  • Previous by thread: Taking brackets off lists
  • Next by thread: Behaviour of TagUnset