I have a list of elements, which I want to sort according to the even/odd numbered positions of elements. Basically creating two lists out of one, respectively having elements placed at even/odd positions in the original list.

For example, A = {a, b, c, d, e, f}; should split into A1 = {a, c, e} and A2 = {b, d, f}.

Will appreciate any help.

  • 3
    $\begingroup$ {A1, A2} = Transpose@Partition[A, 2] $\endgroup$
    – LouisB
    Jan 4, 2020 at 10:37

1 Answer 1

A1 = A[[;; ;; 2]];
A2 = A[[2 ;; ;; 2]];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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