Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my work I found that I needed the Extract function. However I was wondering if there was a way to use Part. Assume that mList is a 4-dim array.

I did the following, which worked.

x = {2, 10, 3, 4};
y = Extract[mList, x];

I found that I can't do this.

y = mList[[x]]

Is there a way to convert the list x, into a sequence of integers that I can use in Part? I tried enclosing it in Sequence, but that seemed to have no effect.

As I said, I'm fine without this, I was just wondering.

share|improve this question
up vote 6 down vote accepted
myList = RandomInteger[{0, 10}, {10, 10, 10, 10}];
x = {2, 10, 3, 4};
y = Extract[myList, x]
Part[myList, Sequence @@ x]

On a smaller list:

list = {{a, b}, {c, d}};
{Extract[list, {1, 1}], Part[list, Sequence @@ {1, 1}]}
{a, a}

Knowing that, as Kuba noted, Part[list, Sequence @@ {1, 1}] is equivalent to list[[##]] & @@ {1, 1}.

share|improve this answer

Two further variations of the same theme (actually for the first one only the input syntax is different):


And a different one:

share|improve this answer
The first 2 in particular and very nice! The 3rd was very instructional. – Mitchell Kaplan Jun 13 '14 at 14:38

Try this also:

myList = RandomInteger[{0, 10}, {10, 10, 10, 10}];
y=myList[[Delete[x, 0]]]


y=myList[[x /. List -> Sequence]]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.