1. sequence fracturing

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.

useless

new topic     » topic index » view message » categorize

2. Re: sequence fracturing

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.

This is one of the things we planned for v4.1. along with

R = S[1,4,6] 
R = S[1 .. 4, 6 .. 7, 5] 
new topic     » goto parent     » topic index » view message » categorize

3. Re: sequence fracturing

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 message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu