Re: 3.0.2 BUG! ( maybee)

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

Hayden McKay wrote:
> 
> I don't know if this one has been posted before...
> }}}
<eucode>
> sequence a,b,c,d
> 
> a = {} b = {} c = {} d = {}
> 
> a &= {}   b = append(b, {})  -- a = {}  b = {{}}
> c &= 1    d = append(d, 1 )  -- c = {1} d = {1}
> </eucode>
{{{

> 
> Whats wrong with 'a' ?

Nothing at all, this looks like normal behaviour.

For &= read 'tack onto the end', and for append read append onto the end

You define a as an empty sequence, which is fine.

So a &= {} reads as 'tack an empty sequence onto an empty sequence'

whereas b is defined as an empty sequence, but you then append another empty
sequence to it - call it a place holder if you like, so that b is no longer
empty, but contains another empty sequence.

Make sense?

Try this

sequence a, b, c, d
a = {} b = {} c = {} d = {}

a &= {}
printf(1, "length(a) = %d\n", {length(a)} )

b = append(b, {})
printf(1, "length(b) = %d\n", {length(b)} )

c &= 1  --this is not empty
printf(1, "length(c) = %d\n", {length(c)} )

d = append(d, 1)
printf(1, "length(d) = %d\n", {length(d)} )

puts(1, 1/0)


> 
> ps. I have a long algorythm with lots of &=, append, [$] stuff that
>     aint workin'. I'll have to trace it to find out more.



http://euallegro.wikispaces.com
http://members.aol.com/chriscrylex/euphoria.htm
http://uboard.proboards32.com/
http://members.aol.com/chriscrylex/EUSQLite/eusql.html

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

Search



Quick Links

User menu

Not signed in.

Misc Menu