musique/examples/common-array-operations.mq
Robert Bendun ddf9cc8f8c New declaration syntax x := foo instead of var x = foo
Additionaly moving into multiparameter binary operations
2022-09-18 14:50:20 +02:00

5 lines
221 B
Plaintext

map := [fn array | var 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)];