RE: Standard Euphoria Library Project

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

Kat,

Please tell me if this program works, or if you get an error about 
nothing  being assigned to 'test'.  It works for me so if it doesn't 
work for you, then your Euphoria is broken...

-- save as 'remove.ex' or something like that
sequence test
  test = "Kat"


function remove( integer i, sequence s )
  -- remove ith element from s
     return s[1..i-1] & s[i+1..length(s)]
end function 

for i = 1 to length( test ) do
  puts( 1, remove( i, test ) & "\n" )
end for
------------------------------------- eof

You should see:
at
Kt
Ka

-- Brian

Kat wrote:
> On 7 Feb 2001, at 10:54, Brian Broker wrote:
> 
> > FYI: this is straight out of our friendly refman doc:
> > 
> > You can delete element i of any sequence s by concatenating the parts of 
> > 
> > the sequence before and after i: 
> > 
> >  s = s[1..i-1] & s[i+1..length(s)]
> 
> But this would crash for me, with that error about nothing being 
> assigned to s to get 
> the length of. I am using v2.2, the complete edition, according to Exw.
> 
> Kat

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

Search



Quick Links

User menu

Not signed in.

Misc Menu