How do I perform the riffle function backward? [duplicate]

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}?

• {a,b,c,d,e,f}[[#;;;;2]]&/@{1,2} Commented Jun 2, 2014 at 13:51
• Transpose[Partition[{a, b, c, d, e, f}, 2]] Commented Jun 2, 2014 at 13:54
• @belisarius (& nikie) Why don't you post an answer? Commented Jun 2, 2014 at 13:54
• @Szabolcs b/c I don't fully understand the question. Specifically, what has Riffle[] to do with Part[]? Commented Jun 2, 2014 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. Commented Jun 2, 2014 at 13:58

You may want to try

ClearAll[unRiffle];
unRiffle[{}] = {{}, {}};
unRiffle[x_List] := x[[# ;; ;; 2]] & /@ {1, 2}
{lOdd, lEven} = unRiffle[{a, b, c, d, e, f}]
(*
{{a, c, e}, {b, d, f}}
*)

• Bad alternative: Rest@Extract[list, {{}, {;; ;; 2}, {2 ;; ;; 2}}] Commented Jun 2, 2014 at 14:18

Just for fun:

ClearAll[unRiffle];
unRiffle[{a_, l___}, {x___}, y_] := unRiffle[{l}, y, {x, a}];
unRiffle[{}, x_, y_] := {x, y};
unRiffle[l_List] := unRiffle[l, {}, {}];