Re: another newbie question
- Posted by Ad Rienks <kwibus at DOLFIJN.NL> Aug 31, 1999
- 452 views
> ----- Original Message ----- > From: Brian K. Broker <bkb at CNW.COM> > To: <EUPHORIA at LISTSERV.MUOHIO.EDU> > Sent: Monday, August 30, 1999 3:59 AM > Subject: Re: another newbie question > =C2=A0 > =C2=A0 > <snip> > =C2=A0 > > Can't help you here (not sure if I follow). Rob? > > > > >So how do i specify to print the 2nd nested sequence? > > > > printf(1, "%s\n", { thisseq[nest2] } ) -- derived from your previo= us > > example > =C2=A0 > Given: > sentword =3D {"test1",{"test2","test3"}} > =C2=A0 > printf(1,"%s\n", sentword[1] ) > -- prints: t > =C2=A0 > printf(1,"%s\n", {sentword[1]} ) > -- prints: test1 > =C2=A0 > printf(1,"%s\n", sentword[2] ) > -- prints: test2 > =C2=A0 > I have ordered an epiphany, and i hope it is delivered soon, so i can= really > grasp exactly and fully all the implications of the preceeding and re= vel in > it, but for now, how do i avoid the following error msg with a test > preceeding the print statement? > =C2=A0 > printf(1,"%s\n", {sentword[2]} ) > -- prints: sequence found inside character string > =C2=A0 > I don't know how many sequences are inside sentword[2] or how deep th= e > nesting may be inside sentword[2] (or inside sentword[2][3][6], etc).= If i > must do extensive parsing of the {sentword} before i determine if a s= ection > can be printed or sliced or added to, what is the advantage to nestin= g > sequences? And i cannot use sequence() to test with? It seems to me i= need > another sequence (or another field inside {sentword}.) to record what= in > {sentword} is a sequence and what is a nested sequence. > =C2=A0 > sentword =3D {{1,2},"test1",{{1,1,2},"test2","test3",{{1},"test4"}}} > =C2=A0 > Can i trap that Eu error msg and recover from it? > =C2=A0 > Kat, > foolishly trying to make it simple. > Or is it too simple already? > -- kat.ex -- shows you the levels of nesting of text sequences -- do with it what you want -- Ad Rienks kwibus at dolfijn.nl include graphics.e -- for get_position procedure put_position(integer level) sequence pos pos =3D get_position() position(pos[1], 9 * (level - 1) + 1) puts(1, "Level: " & sprintf("%d ", level)) end procedure -- set_position procedure slice(sequence s, integer level) if sequence(s) then for n =3D 1 to length(s) do if sequence(s[n]) then level +=3D 1 put_position(level) slice(s[n], level) level -=3D 1 if level > 0 then put_position(level) end if else text_color(BRIGHT_WHITE) puts(1, s[n]) text_color(WHITE) end if end for puts(1, '\n') end if end procedure -- slice sequence sentword sentword =3D {"test1", {"test2", {"test3", "test4"}}, "test5"} slice(sentword, 0) | Gratis e-mail en meer: http://www.dolfijn.nl/ | Een product van Ilse: http://www.ilse.nl/