> 
# Line type
#type _TNL1 expression type {`+`,`*`,`=`, `symbol`,procedure} 2D line or any expression function equation

> 
#type _TNL2 listlist [[a,b],[c,d]] or [[a,b,c],[d,e,f]] 2D line just draws a line between the 2 points

> 
#type _TNL4 listlist [[a,b,c],[d,e,f]] 3D line just draws a line between the 2 points

> 
#type _TNL4 list of list & vector 2D [[a,b],<c,d>] or possibly [<c,d>,[a,b]] 2D generates line A*x+B*y+C

> 
#type _TNL5 list of list & vector 3D [[a,b,c],<d,e,f>] or possibly [<d,e,f>,[a,b,c]] 3D line <a+alpha*d, b+alpha*e, c+alpha*f>

> 
#type _TNL6 vector 3D <a+alpha*d, b+alpha*e, c+alpha*f> 3D line <a+alpha*d, b+alpha*e, c+alpha*f> checks indets to know

> 
#type _TNL7 list of vector[row] and vector[row] [<abc>, <def>] projective points are converted to [a/c,b/c] and [d/f,e/f] and line drawn between the points

> 
sorts:=proc(l1::{list,set,Vector[column],`+`,`*`,`=`, `symbol`,procedure},
{range::list:=[5,5,4,4]},
{vars::list:=[':x',':y']},
{rangep::list:=[3,3]},
{plopts::list:=[':colour'=':blue,magenta']})
description " sort the list of line formats and converts to plotable format ";
local i,n,Listsystem,subplt, subL, tmp, vv,ll,subpltemp;
#single line;
if l1::{'Vector[column]',`+`,`*`,`=`, `symbol`,procedure} then
n:=1;
subplt:=[{}];
if l1::'Vector[column]'(3) and indets(l1)={} then
subL:=[l1[1]*vars[1]+l1[2]*vars[2]+l1[3]];
else
subL:=[l1];
end if;
elif l1::list and nops(l1)= 2 and not(hastype(l1,set))then
#for j to 2 do
# if l1[j][1]::listlist or l1[j][2]::listlist then
# this section not finished supposed
# to detect is the list is two line without extra plopts, range, rangexy
# end if;
# end do;
n:=1;
subplt:=[{}];
#print("here now");
if hastype(l1,'Vector[column]'(3)) and hastype(l1,list) then
#print("in here");
vv:=(select(type,l1,('Vector[column]'(3)))[]);
ll:=select(type,l1,list)[];
#print("vv " ,vv, "ll",ll);
subL:=[ll+~alpha*vv];
elif hastype(l1,'Vector[column]'(2)) and hastype(l1,list) then
vv:=(select(type,l1,('Vector[column]'(2)))[]);
ll:=select(type,l1,list)[];
subL:=[ (ll[2]  vars[2])*vv[1]  vv[2]*(ll[1]  vars[1])];
else
subL:=[l1];
end if;
#single line with own suboptions plopts range rangep bundled as a set
elif l1::set then
n:=1;
subpltemp,tmp:=selectremove(has,l1,{':rangep',':range',':plopts',':rangep'});
#print("00",subpltemp,tmp);
subplt:=`if`(has(subpltemp,{':plopts',':range',':rangep'}),[subpltemp],[{}]);
tmp:=op(tmp);
#print("TMP ",tmp ,nops(tmp));
if tmp::{'Vector[column]',`+`,`*`,`=`, `symbol`,procedure} then
if tmp::'Vector[column]'(3) and indets(tmp)={} then
subL:=[tmp[1]*vars[1]+tmp[2]*vars[2]+tmp[3]];
elif hastype(tmp,'Vector[column]'(2)) and hastype(tmp,list) then
vv:=select(type,tmp,'Vector[column]'(2))[];
ll:=select(type,tmp,list)[];
subL:= [(ll[2]  vars[2])*vv[1]  vv[2]*(ll[1]  vars[1])];
else
subL:=[tmp];
end if;
elif nops(tmp)= 2 then
#print("0th nops(tmp)",nops(tmp),tmp);
# print("here here now");
if hastype(tmp,'Vector[column]'(3)) and hastype(tmp,list) then
#print("in here here");
vv:=(select(type,tmp,('Vector[column]'(3)))[]);
ll:=select(type,tmp,list)[];
#print("vv " ,vv, "ll",ll);
subL:=[ll+~alpha*vv];
elif hastype(tmp,'Vector[column]'(2)) and hastype(tmp,list) then
vv:=(select(type,tmp,('Vector[column]'(2)))[]);
ll:=select(type,tmp,list)[];
subL:=[ (ll[2]  vars[2])*vv[1]  vv[2]*(ll[1]  vars[1])];
else
subL:=[tmp];
end if;
end if;
#a list of lines with possible suboptions if
else
n:=nops(l1);
subplt:=[];
subL:=[];
for i to n do
subpltemp:=select(has,l1[i],{':plopts',':range',':rangep'});
#print("subpltemp",subpltemp);
#print("subpltemp",has(subpltemp,{':plopts',':range',':rangep'}));
if has(subpltemp,{':plopts',':range',':rangep'})then subplt:= [subplt[],subpltemp]else subplt:=[subplt[],{}] end if;
tmp:=select(not(has),l1[i],{':plopts',':range',':rangep'});
if type(tmp,set)then tmp:=op(tmp)end if;
#print("TMP ",tmp ,nops(tmp));
#print("1st nops(tmp)",nops(tmp),tmp);
if tmp::{'Vector[column]',`+`,`*`,`=`, `symbol`,procedure} then
if tmp::'Vector[column]'(3) and indets(tmp)={} then
subL:=[subL[],tmp[1]*vars[1]+tmp[2]*vars[2]+tmp[3]];
else
subL:=[subL[],tmp];
end if;
elif nops(tmp)= 2 then
#print("nops(tmp)",nops(tmp),tmp);
#print("2nd here here now");
if hastype(tmp,'Vector[column]'(3)) and hastype(tmp,list) then
#print("in here here");
vv:=(select(type,tmp,('Vector[column]'(3)))[]);
ll:=select(type,tmp,list)[];
#print(tmp,"vv " ,vv, "ll",ll);
subL:=[subL[],ll+~alpha*vv];
elif hastype(tmp,'Vector[column]'(2)) and hastype(tmp,list) then
vv:=(select(type,tmp,('Vector[column]'(2)))[]);
ll:=select(type,tmp,list)[];
#print(tmp,"vv " ,vv, "ll",ll);
subL:= [subL[],(ll[2]  vars[2])*vv[1]  vv[2]*(ll[1]  vars[1])];
else
subL:=[subL[],tmp];
end if;
end if;
end do;
end if:
return subplt, subL, n
end proc:

> 
L1:=2*x+3*y4;
L1ext:={L1, range=[5,2,4,4],plopts=[colour=red ,linestyle=dot] };
L2:=<5,1,3>:
L2ext:={L2,plopts=[linestyle=dash, thickness=4]}:
L3:=[[2,1],[4,5]]:
L3ext:={L3,plopts=[color=red,thickness=1]}:
L4:=[[2,1,3],[4,5,2]]:
L4ext:={L4,plopts=[color=green]}:
L5:=[[2,3],<1,4>]:
L5ext:={L5,plopts=[color=green,thickness=2],range=[6,6,6,6]}:
L6:=[[1,2,3],<3,1,4>]:
L6ext:={L6,rangep=[4,1],plopts[linestyle=dash]}:
L7:=<1+3*alpha,41*alpha,1+2*alpha>:
L7ext:={L7,rangep=[4,1],plopts=[colour=purlpe,thickness=3]}:
L8:=[<231>,<472>]:
L8ext:={L8,plopts=[colour=red]}:


(1) 
> 
Lst:=[L1,L1ext,L2,L2ext,L3,L3ext,x^2+2*y^2+34*x*y,L4,L4ext,L5,L5ext,L6,L6ext,L7,L7ext,L8,L8ext]:

> 
for i to c do
print(i," A= ",A[i]," B= ",B[i]);
end do


(2) 
