Hi all,

I am playing around with a function that search through a block containing
binary values.
My function searches through the block for the binary #{ACDC} plus #{??}

The problem I encounter is when I run the function multiple times, the
binary variable "data_to_find" remembers old data from the same function,
even if I clear it.

Can someone please explain this behaviour and give me some hints of how to
get around it? 

Here's the script:
-----------------------------------------------------------
find_stuff: func ["Find stuff in data_block"] [

  tail_data: ""
  tail_data: ask "what data do you want to find after ACDC? "
  probe data_to_find: ""
  probe clear data_to_find
  probe data_to_find: #{ACDC}
  probe append data_to_find do rejoin ["#{" tail_data "}"]

  result: []
  clear result
  foreach data data_block [
    if find data data_to_find [
      append result data
    ]
  ]
print rejoin ["Found " length? result " containing " data_to_find]
]
------------------------------------------------------------
Here's an example of running the script:
------------------------------------------------------------
>> data_block: [#{ACDC01} #{ACDC02} #{ACDC03} #{ACDC01} #{ACDC02}]
== [#{ACDC01} #{ACDC02} #{ACDC03} #{ACDC01} #{ACDC02}]

>> find_stuff
what data do you want to find after ACDC? 01
""
""
#{ACDC}
#{ACDC01}
Found 2 containing #{ACDC01}

>> find_stuff
what data do you want to find after ACDC? 01
""
""
#{ACDC01}                      <----- Where does 01 come from?
#{ACDC0101}                      
Found 0 containing #{ACDC0101}
>> find_stuff
what data do you want to find after ACDC? 02
""
""
#{ACDC0101}                    <----- Where does 0101 come from?
#{ACDC010102}                     
Found 0 containing #{ACDC010102}
>>
-----------------------------------------------------------
Brgds /Micael
-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to