with(combinat):

list1 := permute([a, b, a, b, a, b], 3);

list1a := subs(b=1,subs(a=0, list1));

list1a := permute([seq(seq(k,k=0..1),k2=1..3)], 3);

list2 := permute([a, b, c, d, e, f, g, h, a, b, c, d, e, f, g, h, a, b, c, d, e, f, g, h], 3);

list3 := subs(h=18,subs(g=17,subs(f=16,subs(e=15,subs(d=14,subs(c=13,subs(b=12,subs(a=11,list2))))))));

list3 := permute([seq(seq(k,k=11..18),k2=1..3)], 3);

list5 := Matrix(nops(list1a)*nops(list3), 1);

count := 1;

for n from 1 to nops(list3) do

temp1 := subs(1=list1a[1],list3[n]);

for k from 11 to nops(list1a)+10 do

temp1 := subs(k=list1a[k-10],temp1);

od;

list5[count] := temp1;

count := count + 1;

od;

list6 := permute(list5, 2);

Error, (in combinat:-permute) 1st argument must be a list, set or a non-negative integer