Re: sequence fracturing

new topic     » goto parent     » topic index » view thread      » older message » newer message
useless said...

In the following:

include std/search.e 
 
sequence list = "ABCABAB" 
 
s = find_all('A',list) 
-- s is {1,4,6} 
return list[s] -- crashes here 

Obviously, that is a useless bit of code, but it illustrates the problem. Can this be made to not crash, but to return as if i typed out list[1], list[4], list[6], or looped thru s? It just seems this should work.

You can modify your code slightly...

include std/search.e 
include std/sequence.e 
 
sequence list = "ABCABAB" 
 
s = find_all('A',list) 
-- s is {1,4,6} 
return extract(list, s)) 

Jeremy

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu