Given a list, test if a certain logical condition (i.e. predicate) holds for all items of the list.
fsharp fsharplet rec IsAll predicate source =
let mutable acc = true
for e in source do
acc <- acc && (predicate e)
acc
let rec IsAll predicate source =
let mutable acc = true
for e in source do
acc <- acc && (predicate e)
acc
Submit a new solution for
fsharp
There are 11 other solutions in
additional languages (
clojure,
cpp,
erlang,
fantom ...)