musique/examples/common-array-operations.mq

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));