Question: How to do crossover between lists?

Does anyone know how to do crossover between block of binary number?

Example :

If I have 4 blocks, [0011001],[0011100], [0101010], and [1001110].

the first block will crossover with the second block, the second block will crossover with the third block, the third block will crossover with the last block and the last block must crossover with the first block. 

I had tried the code as below. 

for i from 1 to 4 do

for j from 1 to 7 do

block[i][j]:=block[i+1][j];

end do;

new_block[i]:=block[i];

end do;

The problem is the crossover can be done from 1 with 2, 2 with 3 and 3 with 4. But this code unwork for crossover for last block with the first block. Can someone help me? thank you in advance.

Please Wait...