Re: Discuss changing the behaviour of append()

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

Can you point out where there are any logic errors in this function or discussion of mine, please.

The code I posted earlier was the working code. My first attempt at this function used the append() function but that failed at times, due to it trying to append to an atom.

Instead of ...

S[I[1]] &= {X} 

my original function had

integer n = I[1] 
S[n] = append(S[n], X) 

This fails when the item at S[n] is an atom.

There is nothing amazing that "this fails". Manual reads: Syntax: s2 = append(s1, x)

You had to append to the sequence, not to an atom.
Your logic was erroneous, you thought that S[n] can not be an atom.
But why not ???
If S={1,2,3,4} then S[3]=3
The atom!

That above was about the function logic.

And there is no any reason to tell on append() if your function works after correction with append() and (much better) with &.
This is about the discussion logic.

But if you wanna another append(), it is fully another story.

Regards


kinz

I started to respond to this, then I realized that it was more-or-less identical to http://openeuphoria.org/forum/m/124582.wc, which I already responded to.

Perhaps we should take a different tack. What is the compelling original reason for append() to have refused to accept atoms as the first parameter in the first place?

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

Search



Quick Links

User menu

Not signed in.

Misc Menu