Hi! First post here, very new to Typst but truly loving it :).
I was expecting the array.remove()
method to return the array without the removed element, but instead it returns the removed element. Is there an alternative method?
If not, how do I create a method myself? I managed to create a function that does what I want, but not a method for the array type. How do I do that? Could not find anything about that in the docs.
#let a = (1,2,3)
#a.remove(1) // Returns "2", I want (1, 3)
#a // Returns (1,3)
#a.filter(x => x != 2) // Returns (1,3) but filters by content not index.
#let remove-return(array, index) = {
array.remove(index)
return array
}
#let a = (1,2,3)
#remove-return(a, 1) // Works!
// #a.remove-return(1) // Error: "type array has no method remove-return"