* Re: request for help with suffix arrays
[not found] <20040415100008.26015.9137.Mailman@ref.ntg.nl>
@ 2004-04-15 18:09 ` Jonathan Nicholl
0 siblings, 0 replies; only message in thread
From: Jonathan Nicholl @ 2004-04-15 18:09 UTC (permalink / raw)
> Message: 11
> From: "vinuth madinur" <vinlin@linuxmail.org>
> To: ntg-context@ntg.nl
> Date: Thu, 15 Apr 2004 11:40:27 +0800
> Subject: [NTG-context] Re: help required w.r.t " vardef "
> Reply-To: ntg-context@ntg.nl
>
> Thanks Hans!
> That wolud help me a lot.Also thanks for the reference u
> mentioned.I'll try it.
>
> Now one last thing :
>
> Is there a way of having variable arrays whose contents can be used
> as "suffixes"?
>
> something like ,
>
> a[0]:= "A" ;
> a[1]:= "B" ;
> a[2]:= "C" ; %a variable array "a[]"
>
>
> there are other three "pair" variables : T.A,T.B,T.C;
>
> so now I want to have ,
>
> i := 0;
> T.a[i] = blahblah();
>
> so here I want to use the contents of "a[]" as suffix of variable " T
> " .
>
> I don't know what kind of data type to use for "a[]".
> I tried a[] as string type and used it with
>
> forsuffixes $=a[0],a[1],a[2]:
> .....
> endfor;
> but this does not work.
>
> So, can u please help me out here?
> thanx in advance.
>
> Vinuth.
> --
> ______________________________________________
> Check out the latest SMS services @ http://www.linuxmail.org
> This allows you to send and receive SMS through your mailbox.
>
>
> Powered by Outblaze
You could use 'scantokens':
string a[];
a 1 := "A";
a 2 := "B";
a 3 := "C";
T A := 11;
T B := 12;
T C := 13;
for i = 1 upto 3:
show (T scantokens a [i]);
endfor;
end
This produces the output
>>11
>>12
>>13
The idea is to store the suffixes as strings, and then use 'scantokens'
to extract them.
Best wishes,
Jonathan
-----------------------
Jonathan Nicholl
Department of Philosophy
King's College London
^ permalink raw reply [flat|nested] only message in thread