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

[REBOL] SV: Re: Func, why does it remeber previous data?

From: micael:gullmes:telenordia:se at: 11-Nov-2000 0:06

Hej Andrew, Thanks for the hints, I changed according to your suggestions. But the function still gets incorrect data, any other ideas? --- find_stuff2: func ["Find stuff in data_block"] [ tail_data: make string! 0 tail_data: ask "what data do you want to find after ACDC? " probe data_to_find: make string! 0 probe clear data_to_find probe data_to_find: #{ACDC} probe append data_to_find do rejoin ["#{" tail_data "}"] result: make block! 0 clear result foreach data data_block [ if find data data_to_find [ append result data ] ] print rejoin ["Found " length? result " containing " data_to_find] ] But I still get the same fault:
>> find_stuff2
what data do you want to find after ACDC? 01 #{ACDC} #{ACDC01} Found 2 containing #{ACDC01}
>> find_stuff2
what data do you want to find after ACDC? 01 #{ACDC01} #{ACDC0101} Found 0 containing #{ACDC0101} Brgds /Micael -----Ursprungligt meddelande----- Från: Andrew Martin [mailto:[Al--Bri--xtra--co--nz]] Skickat: den 10 november 2000 23:41 Till: [rebol-list--rebol--com] Ämne: [REBOL] Re: Func, why does it remeber previous data?
> tail_data: ""
Use: tail_data: make string! 0 instead. Think of ":" as being: Set the word to the left to _POINT_ to the string at the right. So this: tail_data: "" actually means: Set the word "tail_data" to this particular empty string. It's like assigning a pointer in C/C++, OK? The same thing applies here:
> result: []
Use: result: make block! 0 instead. Andrew Martin ICQ: 26227169 http://members.nbci.com/AndrewMartin/