|
[Date Index]
[Thread Index]
[Author Index]
Re: List Manipulation
list1 = {{n1}, {n2}, {n3}, {n4}, {n5}}; list2 = {{n1}, {n2}, {n3}, {n4},
{n5}, {n6}};
listOdd[x_List/; OddQ[Length[x]]] :=
Append[First[Transpose[Partition[x, 2]]], Last[x]] listOdd[x_List/;
EvenQ[Length[x]]&&Length[x]>0] :=
First[Transpose[Partition[x, 2]]]
listEven[x_List/;Length[x]>0] :=
Last[Transpose[Partition[x, 2]]]
listOdd[list1]
{{n1},{n3},{n5}}
listOdd[list2]
{{n1},{n3},{n5}}
listEven[list1]
{{n2},{n4}}
listEven[list2]
{{n2},{n4},{n6}}
Bob Hanlon
Prev by Date:
Re: Shooting Problem (fwd)
Next by Date:
[Q]Mathematica: Alternative to GrayLevel for photocopies?
Prev by thread:
Re: List Manipulation
Next by thread:
RE: List Manipulation
|