diff --git a/lib/std/core/list.kk b/lib/std/core/list.kk index 27a1c843f..a0b48e764 100644 --- a/lib/std/core/list.kk +++ b/lib/std/core/list.kk @@ -529,6 +529,9 @@ pub fun any( xs : list, predicate : a -> e bool ) : e bool Cons(x,xx) -> if predicate(x) then True else xx.any(predicate) Nil -> False +pub fun contains( xs : list, item: a, ^?(==): (x: a, y: a) -> bool) : bool + xs.any(_ == item) + // Return the sum of a list of integers pub fun sum( xs : list ) : int xs.foldl( 0, fn(x,y) { x + y } )