on master help sign in
Merge pull request #1299 from Heather/isInfixOf_for_List

isInfixOf for List

commit13a6bf41b5eca994e062b81406b7edbb413dbe17 authorEdwin Brady <edwin.brady@gmail.com> dateMon 9 Jun 2014, 12:51 (12 years ago) parent2b183c817ecdef
1 file changed+3
libs/prelude/Prelude/List.idr+3
libs/prelude/Prelude/List.idr+3
@@ -579,6 +579,9 @@ isSuffixOfBy p left right = isPrefixOfBy p (reverse left) (reverse right)
579579isSuffixOf : Eq a => List a -> List a -> Bool
580580isSuffixOf = isSuffixOfBy (==)
581581
582+isInfixOf : Eq a => List a -> List a -> Bool
583+isInfixOf n h = any (isPrefixOf n) (tails h)
584+
582585--------------------------------------------------------------------------------
583586-- Sorting
584587--------------------------------------------------------------------------------