musique/examples/common-array-operations.mq

5 lines
226 B
Plaintext

var map = [fn array | var result = []; for array [v | result = result & [fn v] ]; result];
var drop = [n arr | arr.(range n (len arr))];
var take = [n arr | arr.(up n)];
var filter = [predicate arr | arr.(map predicate arr)];