/// <summary> /// Return true if *any* items in the map return true when the predicate is applied /// </summary> /// <param name="pred">Predicate</param> /// <returns>True if all items in the map return true when the predicate is applied</returns> public static bool Exists <K, V>(this HMap <K, V> self, Func <K, V, bool> pred) { foreach (var item in self.AsEnumerable()) { if (pred(item.Key, item.Value)) { return(true); } } return(false); }
public static S Fold <K, V, S>(this HMap <K, V> self, S state, Func <S, K, V, S> folder) => self.AsEnumerable().Fold(state, (s, x) => folder(s, x.Key, x.Value));
public static bool Exists <K, V>(this HMap <K, V> self, Func <KeyValuePair <K, V>, bool> pred) => self.AsEnumerable().Map(kv => new KeyValuePair <K, V>(kv.Key, kv.Value)).Exists(pred);
public static bool Exists <K, V>(this HMap <K, V> self, Func <Tuple <K, V>, bool> pred) => self.AsEnumerable().Map(kv => Tuple(kv.Key, kv.Value)).Exists(pred);