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

This question already has an answer here:

I know riffle will combine the lists {1,2,3} and {a,b,c} to be {1,a,2,b,3,c}. Is there a way to work backward and split the list {a,b,c,d,e,f} to be {a,c,e} and {b,d,f}?

share|improve this question

marked as duplicate by Mr.Wizard Jun 2 '14 at 21:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

{a,b,c,d,e,f}[[#;;;;2]]&/@{1,2} – Dr. belisarius Jun 2 '14 at 13:51
Transpose[Partition[{a, b, c, d, e, f}, 2]] – nikie Jun 2 '14 at 13:54
@belisarius (& nikie) Why don't you post an answer? – Szabolcs Jun 2 '14 at 13:54
@Szabolcs b/c I don't fully understand the question. Specifically, what has Riffle[] to do with Part[]? – Dr. belisarius Jun 2 '14 at 13:56
@belisarius As I understand it (based on the example, which seems clear), yours is a good solution. Get back x and y from the result of Riffle[x,y], provided that x and y are of the same length. – Szabolcs Jun 2 '14 at 13:58

You may want to try

unRiffle[{}] = {{}, {}};
unRiffle[x_List] := x[[# ;; ;; 2]] & /@ {1, 2}
{lOdd, lEven} = unRiffle[{a, b, c, d, e, f}]
 {{a, c, e}, {b, d, f}}
share|improve this answer
Bad alternative: Rest@Extract[list, {{}, {;; ;; 2}, {2 ;; ;; 2}}] – Jacob Akkerboom Jun 2 '14 at 14:18

Just for fun:

unRiffle[{a_, l___}, {x___}, y_] := unRiffle[{l}, y, {x, a}];
unRiffle[{}, x_, y_] := {x, y};
unRiffle[l_List] := unRiffle[l, {}, {}];
share|improve this answer

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