1. sequence errors
------=_NextPart_000_0007_01BFD244.F2BDD740
charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
functions like the one below are neccessary to avoid runtime errors.
if you do these operations on sequence with writing your own code, =
without any function, errors happen quick!, because you have to check so =
many things to avoid errors
o)
With this function everything is clear and error is IMPOSSIBILE
Does anybody have any similar perfect functions for sequence slicing =
....
--eliminates members from sequence, including p1 and p2
global function TsSeq_Eliminate(sequence s,atom p1,atom p2)
atom len
len=3Dlength(s)
if p1>p2+1 then
printf(1,"\n%s",{"Error in function TsSeq_Eliminate: p1>p2"})
end if
p1-=3D1
p2+=3D1
if p1<0 then p1=3D0 end if
if p1>len then p1=3Dlen end if
if p2<1 then p2=3D1 end if
if p2>len+1 then p2=3Dlen+1 end if
return s[1..p1] & s[p2..len]
end function
sequence s,res
s=3D{1,2,3,4,5,6,7,8,9}
--res=3DTsSeq_Eliminate(s,1,1)
--res=3DTsSeq_Eliminate(s,2,3)
res=3DTsSeq_Eliminate(s,12,10)
?res
------=_NextPart_000_0007_01BFD244.F2BDD740
charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-2" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>functions like the one below are =
neccessary to=20
avoid runtime errors.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>if you do these operations on sequence =
with writing=20
your own code, without any function, errors happen quick!, because you =
have to=20
check so many things to avoid errors</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>
o)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>With this function everything is clear =
and error is=20
IMPOSSIBILE
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Does anybody have any similar perfect =
functions for=20
sequence slicing ....</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>--eliminates members from sequence, =
including p1=20
and p2<BR>global function TsSeq_Eliminate(sequence s,atom p1,atom=20
p2)<BR> atom len<BR> len=3Dlength(s)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> if p1>p2+1=20
then<BR> printf(1,"\n%s",{"Error in function TsSeq_Eliminate: =
p1>p2"})<BR> end if</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial =
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> if p1<0 then p1=3D0 end =
if<BR> if=20
p1>len then p1=3Dlen end if<BR> if p2<1 then p2=3D1 end =
if<BR> if=20
p2>len+1 then p2=3Dlen+1 end if</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2> return s[1..p1] & =
s[p2..len]<BR>end=20
function</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>sequence s,res</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>s=3D{1,2,3,4,5,6,7,8,9}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial=20
<DIV><FONT face=3DArial=20
</FONT></DIV>
<DIV> </DIV>
------=_NextPart_000_0007_01BFD244.F2BDD740--