musique/examples/common-array-operations.mq
2022-10-27 22:32:20 +02:00

6 lines
221 B
Plaintext

map := (fn array | result := (), for array (v | result = result & (| fn v) ), result),
drop := (n arr | arr.(range n (len arr))),
take := (n arr | arr.(up n)),
filter := (predicate arr | arr.(map predicate arr)),