Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

block of blocks of strings

 [1/3] from: louisaturk::coxinet::net at: 21-Apr-2003 18:35

Hi rebols, I want to read/lines a file, and convert it into a block of blocks of strings. Running the following program should display a block of blocks of strings. Instead it displays a single block of strings. I do I get what I want? Louis rebol [] x: read/lines %scm-short.txt comment { Contents of %scm-short.txt: Mat 1:1 Bi,bloj =FFbi,bloj =FFnnfs gene,sewj =FFge,nesij =FFngfs VIhsou/ =FFVIhsou/j =FFngms Cristou/( =FFCristo,j =FFngms ui`ou/ =FFui`o,j =FFngms Dabi.d( =FFDaui,d =FFtp ui`ou/ =FFui`o,j =FFngms VAbraa,m=C5 =FFVAbraa,m =FFtp Mat 1:2 VAbraa.m =FFVAbraa,m =FFtp evge,nnhse =FFgenna,w =FFviaa3s to.n =FFo` =FFdams VIsaa,k\ =FFVIsaa,k =FFtp VIsaa.k =FFVIsaa,k =FFtp de. =FFde, =FFc evge,nnhse =FFgenna,w =FFviaa3s to.n =FFo` =FFdams VIakw,b\ =FFVIakw,b =FFtp VIakw.b =FFVIakw,b =FFtp de. =FFde, =FFc evge,nnhse =FFgenna,w =FFviaa3s to.n =FFo` =FFdams VIou,dan =FFVIou,daj =FFnams kai. =FFkai, =FFc tou.j =FFo` =FFdamp avdelfou.j =FFavdelfo,j =FFnamp auvtou/\ =FFauvto,j =FFrpgms Mat 1:3 VIou,daj =FFVIou,daj =FFnnms de. =FFde, =FFc evge,nnhse =FFgenna,w =FFviaa3s to.n =FFo` =FFdams Fa,rej =FFFa,rej =FFtp kai. =FFkai, =FFc to.n =FFo` =FFdams Zara. =FFZa,ra =FFtp evk =FFevk =FFp th/j =FFo` =FFdgfs Qa,mar\ =FFQama,r =FFtp Fa,rej =FFFa,rej =FFtp de. =FFde, =FFc evge,nnhse =FFgenna,w =FFviaa3s to.n =FFo` =FFdams VEsrw,m\ =FF~Esrw,m =FFtp VEsrw.m =FF~Esrw,m =FFtp de. =FFde, =FFc evge,nnhse =FFgenna,w =FFviaa3s to.n =FFo` =FFdams VAra,m\ =FFVAra,m =FFtp Mat 1:4 VAra.m =FFVAra,m =FFtp de. =FFde, =FFc evge,nnhse =FFgenna,w =FFviaa3s to.n =FFo` =FFdams VAminada,b\ =FFVAminada,b =FFtp VAminada.b =FFVAminada,b =FFtp de. =FFde, =FFc evge,nnhse =FFgenna,w =FFviaa3s to.n =FFo` =FFdams Naassw,n\ =FFNaassw,n =FFtp Naassw.n =FFNaassw,n =FFtp de. =FFde, =FFc evge,nnhse =FFgenna,w =FFviaa3s to.n =FFo` =FFdams Salmw,n\ =FFSalmw,n =FFtp } ;end comment foreach l x [ replace/all l ", " " , " replace/all l ": " " : " replace/all l "; " " ; " replace/all l ". " " . " replace/all l "=FF" "" ;replace/all l " " "^/" ] write/lines %scm-2.txt x y: read/lines %scm-2.txt bb: [] foreach l y [ ba: [] m: find l ":" index: find m " " append/only ba reduce [copy/part l index] l: find l index l: parse l " " foreach [a b c] l [append/only ba reduce[a b c]] append/only bb make block! ba ; <== Why doesn't this become a block of blocks? ] save %scm-3.txt ba z: load %scm-3.txt z/1

 [2/3] from: Al:Bri:xtra at: 22-Apr-2003 13:01

Louis asked:
> Why doesn't this become a block of blocks?
You need a fresh block at the start of each loop "foreach l y [": ba: COPY [] I hope that helps! Andrew Martin ICQ: 26227169

 [3/3] from: louisaturk:coxinet at: 21-Apr-2003 20:10

Hi everyone, Chris solved the problem for me on the rebol world (AltME). Louis