How does ..array work? (splat/spread?)

I don’t know where to find it in the docs as it is hard to search for. It seams like something like splat in ruby, but I don’t know how to use it other than repeatedly expanding an array into a grid. I’m trying to understand its uses on a deeper level though.

working code

#grid(
  ..(4,8,8,9,89,6,66).map(str)
)

non working code:

#{..(4,8,8,9,89,6,66).map(str)}

#{(4,8,8,9,89,6,66).map(str).." "}  // would unpack to a string in ruby ex [7,7,9,9]*" "

I do not know what would allow one to work and the other to not. If anyone could help explain the nuances of this operator or even how to search it in docs, I’d be grateful.

Hi there,

Lots of examples in the docs if you search for spread or sink.

But used in other examples like the Table guide – Typst Documentation and many forum posts.

2 Likes

Thank you. I was having real trouble finding it searching “… typst” and “splat typst” and looking through the array documentation.

I’d asked Claude.ai and it called it spread but I didn’t realize that would be the search term that I wanted, so I just asked here.

Anyway, thank you for answering here. It should hopefully help anyone who searches “splat typst” in the future.

1 Like