filter
function:
Filter a list. If the first argument is a list, return all the values for which the second argument is a list.
Examples:
- running:
(filter [1, 2, 3, 4], true)
will give:[1, 2, 3, 4]
- running:
(filter [1, 2, 3, 4], null)
will give:[]
- running:
(filter [1, 2, 3, 4, "one", null], (string? .))
will give:["one"]
Because only the value"one"
is a string.
- running:
(filter ., (.number?))
for input:[1, 2, null, "a", 4]
will give:[1, 2, 4]
- running:
(filter {}, true)
will return nothing