# Question:Lists, ops, nops...

## Question:Lists, ops, nops...

Maple

Q: Write a procedure OddEven that takes a list L of integers and returns a list of the odd-numbered entries followed by the even-numbered entries.  So, for example,
OddEven([1,3,5,7,9,11]);
should return [1,5,9,3,7,11].  (Note: unless you find a clever solution you will need a several-line procedure using proc..end proc.   You will perhaps need an if statement so that you can deal with the case where the list has an odd number of elements and where it has an even number of elements separately.)

My ideas...

1) Define 'i' to be even, 'j' to be odd, then use A:=L[i] and B:=L[j] (somehow...) to create 2 lists of the even and odd-numbered entries and put A and B together as a sequence...

Have tried using the assume function and type(i,odd)=true function but i really have no idea what im doing...

2) Using the 'by' function to count every 2nd term starting from 0 for even numbers and 1 for odd numbers. Dont think that would work tho...

3) Some sort of L -> [  L[1] , L[3] , .. , L[n] ] for the odd numbers... similar for even... not sure how to define n, maybe  something like... if n mod 2 = o do => n => else => n-1?

Help!

﻿