1. sequences, i'm confused, as usual
Please? I can't figure this out,,, in the code below, in the first match() i
must use {} to get it to work right, but in the 2nd match(), i don't? If i
*don't* use {} in the 1st one, it fails,, if i *do* use {} in the 2nd one,
it fails. I don't mean the "=" and "!=" in the following lines, i mean the
match() fails. What am i not understanding now?
procedure addrec(sequence rootname, sequence newrec)
integer place
rootname = "xx" & rootname & "xx"
newrec = "xx" & newrec & "xx"
trace(1)
place = match({rootname},mainseq)
if ( place = 0 ) then
puts(1,rootname & " doesn't exist!" & "\n")
return
end if
-- trace(1)
place = match(newrec,mainseq[place])
if ( place != 0 ) then
puts(1,newrec & " exists already!" & "\n")
return
end if
end procedure -- addrec(sequence rootname, sequence newrec)
Kat,
confused as heck again.
2. Re: sequences, i'm confused, as usual
Kat,
If you use find() instead of match(), things will be less confusing.
Colin Taylor
At 01:37 PM 9/15/99 -0500, Kat wrote:
>
>Please? I can't figure this out,,, in the code below, in the first match() i
>must use {} to get it to work right, but in the 2nd match(), i don't? If i
>*don't* use {} in the 1st one, it fails,, if i *do* use {} in the 2nd one,
>it fails. I don't mean the "=" and "!=" in the following lines, i mean the
>match() fails. What am i not understanding now?
>
>procedure addrec(sequence rootname, sequence newrec)
>integer place
>
> rootname = "xx" & rootname & "xx"
> newrec = "xx" & newrec & "xx"
> trace(1)
> place = match({rootname},mainseq)
> if ( place = 0 ) then
> puts(1,rootname & " doesn't exist!" & "\n")
> return
> end if
>-- trace(1)
>
> place = match(newrec,mainseq[place])
> if ( place != 0 ) then
> puts(1,newrec & " exists already!" & "\n")
> return
> end if
>
>end procedure -- addrec(sequence rootname, sequence newrec)
>
>Kat,
>confused as heck again.
>
>