1. Beginners-Guide-To-Euphoria Trace and iterations

I am stepping thru 'A-Beginners-Guide-To-Euphoria-OffLine.htm' from suninyoureye@linuxmail.org . In demo program 43, I am running with trace:

with trace 
   trace(1) 
include get.e 
include wildcard.e 
integer keystroke 
--  
-- ri = find(o,s)  find() searches sequence s for element o.  
--If found, the element number of o is stored in receiving variable ri.  
--If not, 0 is stored in ri. find() starts searching a sequence from the  
--first element onward. 
-- Demo program 43 
include file.e 
sequence string, seek_positions, vowels 
object input_line 
atom file_id, status 
 
vowels = "aeiou" 
 
string = 
"The beauty of the seek() library routine is that you can control\n" & 
"where the next write or read will occur. This will allow you to\n" & 
"update any old information in your file with new data. This eliminates\n" & 
"the need to maintain different versions of the same data in the\n" & 
"file.\n\n" 
 
seek_positions = {} 
for element = 1 to length(string) do 
     if find(string[element],vowels) then 
          seek_positions = append(seek_positions,{element, string[element]}) 
          string[element] = ' ' 
     end if 
end for 
file_id = open("demo.fle","wb") 
puts(file_id,string) 
close(file_id) 

Trace shows that it goes thru ' if find(string[element],vowels) then' once and never gets to: 'seek_positions = append(seek_positions,{element, string[element]}) string[element] = ' ' '

But it has to go thru there, else no correct output. Can Trace be configured so that it shows iterations? Can Trace be configured so that it shows the content of specified variablts?

Thanks!

new topic     » topic index » view message » categorize

2. Re: Beginners-Guide-To-Euphoria Trace and iterations

vmars said...

Trace shows that it goes thru ' if find(string[element],vowels) then' once and never gets to: 'seek_positions = append(seek_positions,{element, string[element]}) string[element] = ' ' '

But it has to go thru there, else no correct output. Can Trace be configured so that it shows iterations? Can Trace be configured so that it shows the content of specified variablts?

It sounds like you may not be using the full capabilities of the interactive tracing. How are you going to the next line? If you use the down arrow, then it will not jump back to the top of a loop. If you use the enter key, then it will.

Also, you can use the '?' to inspect a particular variable. This is somewhat inconvenient with long sequences. There is currently no way to inspect a specific element by itself.

I think that a future version of euphoria--possibly 4.1--will address many issues with respect to interactive tracing.

Matt

new topic     » goto parent     » topic index » view message » categorize

3. Re: Beginners-Guide-To-Euphoria Trace and iterations

<quote> f you use the down arrow, then it will not jump back to the top of a loop. If you use the enter key, then it will. Also, you can use the '?' to inspect a particular variable. </quote>

That helps a lot, thanks.

I notice that Trace can't handle indexing:
?string and ?element work fine.
But not string[element] .
Maybe in the future?

Thanks!

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu