#sort array of tuples

8 messages · Page 1 of 1 (latest)

lilac crane
#

this might be an obvious question, but how do I sort an array of tupils by the first element of the tuple :)

little sphinx
#

?render

#let elements = ((4, 3), (3, 5), (2, 1))

#elements.sorted(key: el => el.at(0))
lilac crane
#

thank you so much, the named argument is mandatory then?

#

thought I could pass the sorter as a positional argument :)

little sphinx
#

it isn't in general

#

I don't think you can pass it as a positional argument

#

either as a named, or not at all