Replace block with paired values

I noticed this using the "replace" block with paired values
Do you think this is a bug?

bug - replace a paired value script pic
(the paired value was replaced but the original order of the list was compromized)

I think the result should be:
image

When i use index instead of paired values: no problems
bug - replace a paired value script pic (2)

another thing:
bug - replace a paired value script pic (3)

(the paired value doesn't exist but a new value was add to the end of the list)

and a last one (insert block):
bug - replace a paired value script pic (4)

(this change the value not insert it and the order is compromized... i don't think insert can handle the paired value...)

That's a feature for Hash Tables/Dictionaries, where order doesn't matter. Therefore, why spend time putting it in the right spot?

deleting a record + adding a record at the end
vs
deleting a record + insert a record at a defined position

I don't think it take much more time...

You'd need to remake the entire linked list.

Watch how it could be easy to change the "ab" paired value:
image

No, I'm with @loucheman about this. We could have introduced dictionaries as an entirely new data type, separate from lists, and then I'd agree that order doesn't matter. But instead we're bending over backward to make a dictionary a kind of list, and so I find this behavior unexpected and confusing. Not promising that Jens will agree.

For what it’s worth, I’m with @loucheman, too.

untitled script pic - 2024-03-09T202431.238

Okay.

yes, you're right abut Dictionaries. They don't guarantee any particular order of entries. It's the same in other programming languages. Folks, if you decide to access a paired list by non-numerical keys instead of indices, you're leaving the "list"-ness behind.

Okay. Cool.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.