array-mumu 0.2.0-rc.5

Array tools plugin for the Mumu ecosystem
Documentation
extend("array")

big = array:filter(
  (n) => n > 10,
  [4,8,15,16,23,42]
)
slog(big)


myFilter1 = array:filter((n) => n > 10)

slog( myFilter1([4,8,15,16,23,42]) )
//prints [15, 16, 23, 42]

slog( myFilter1([2, 12, 9, 100]) )
//prints [12, 100]

//# 3) Partial usage with underscore in the predicate:
#    ( _ ) => true => "We don't care about the input, always return true."
myFilter2 = array:filter((_) => true)

# Now apply it to an array => everything passes the filter.
resultAll = myFilter2([4,8,15,16,23,42])
# Prints [4,8,15,16,23,42]
slog(resultAll)

# 4) Partial usage with underscore for the FIRST parameter (missing the predicate).
#    We do supply the array now ([4,8,15,16,23,42]).
myFilter3 = array:filter(_, [4,8,15,16,23,42])

# Later, we call that partial with the actual predicate => (n) => n>10
resultPartial = myFilter3((n) => n > 10)

# This prints [15, 16, 23, 42]
slog(resultPartial)