List Function idea

It would be really handy if we had an Insert function for Lists (arrays). Something like:

INSERT(myList, index, value)

for example, to put the value “2” in between “1” and “3” in the following list:
myList[0,1,3,4,5]

you would do:
INSERT(myList, 1, 2)

which would then return the array:
myList[0,1,2,3,4,5]

just an idea. We can Append items to the end easy enough, but inserting items is complicated.

Hi, good news, this function is coming up, and is already available in the beta program!
The function will be called INSERT_ITEM_AT and will it work exactly as you described.

Here’s the full list of upcoming new formula functions:

  • UNION
  • SYMMETRIC_DIFFERENCE
  • SPLICE
  • SOME
  • SET_ITEM
  • SET_ITEM_AT
  • REMOVE_ITEMS_AT
  • REMOVE_ITEM
  • LAST_ITEM
  • INTERSECTION
  • INSERT_ITEMS_AT
  • INSERT_ITEM_AT
  • FLATTEN
  • FIRST_ITEM
  • EXACTLY_ONE
  • EVERY
  • DIFFERENCE
2 Likes

I would like to also suggest that “index” be a built in property of “current” in repeated items. It would be sooooo useful to be able to reference current.index for a selected item.

That will actually be possible in 2.X, although with a different syntax! The current syntax is planned to be repeatedInfo.current.index.

Other available information:
Screenshot 2020-11-13 at 14.05.05

1 Like