ink icon indicating copy to clipboard operation
ink copied to clipboard

When printed, LISTS are not displaying the correct order.

Open VertexZero opened this issue 5 years ago • 1 comments

Hi guys, the issue I found is this one:

I have a list... LIST m_List = (nothing)

Then, after adding items to m_List: ~ m_List += (item_1, item_2)

And subsequently, after printing the List, {m_List}

The order displayed is: nothing, item_2, item_1

But when I use a function to check for eacxh element's index, it works as intended.

Thanks!

VertexZero avatar Jun 05 '20 20:06 VertexZero

I came across this issue looking for something else, and you've probably solved it or moved on by now. Just in case:

Either the issue was fixed behind the scenes, or your problem is that items aren't added to the list based on the order you add them but in based on their index in the "real" list. So this code:

LIST list = a,b,c
LIST tsil = x,y,z

~ list += (a, z, c, y)
{list}

Will always give you a,y,c,z because the "real" indexes are a =1, z =3, c =3, and y =2. For items with the same index, ink gives priority by ASCII value. So renaming tsil to atsil will change the order to a,y,z,c

If the order is vital in the final list, the best path is probably defining them so the indexes won't overlap LIST list = (nothing = 100) LIST list2 = item1 = 900, item2 = 901)

menaechmi avatar Feb 14 '25 04:02 menaechmi