RE: Standard Euphoria Library Project

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

On 7 Feb 2001, at 14:23, Brian Broker wrote:

> 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

I'm puzzled, i saw those. And i added a few line to the bottom:

include get.e
integer key
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

key = wait_key()

test = ""
puts(1,"\n"&sprintf("%d",length(test))&"\n")

puts(1," ^ printed length of test\n")
key = wait_key()

and i got the length of test = 0, which is correct, but it has been crashing, i
swear!

Kat

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

Search



Quick Links

User menu

Not signed in.

Misc Menu