Question: creating adjacent lists within a list

Hello,

I am working on a homework assignment for a Maple class and am hung up on creating adjacent lists within a list.  I know that I need to use the seq command with a i=1..(end) condition, but that code only creates the list, not the lists within the lists..

Here is the actual problem statement:

Consider the list

monthList := [ january, february, march, april, may, june, july, august, september, october, november december ];

Make a list of lists of adjacent pairs of entries from monthList, preserving the order of the entries in original list.  You should use the "seq" and "op" commands discussed in lecture11.mw, not simply type everything out.

The output of the answer should be:

[ [january, february], [february, march], ... , [october, november], [november, december] ]

however, my current code:

[ seq(op(i..(i+1), monthList), i=1..11) ];

gives

[january, february, february, march, march, april, ... october, november, november, december ]

 

What am I doing wrong??!

Thanks,

- Ben

 

Please Wait...