RosettaCodeData/Task/Sort-an-array-of-composite-structures/MAXScript/sort-an-array-of-composite-structures.max

14 lines
227 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
fn keyCmp comp1 comp2 =
(
case of
(
(comp1[1] > comp2[1]): 1
(comp1[1] < comp2[1]): -1
default: 0
)
)
people = #(#("joe", 39), #("dave", 37), #("bob", 42))
qsort people keyCmp
print people