on master help sign in
isInfixOf for List
commit17ecdefd64deea884b5a4bb7ddfc8b3912bb9a43 authorHeather <heather@live.ru> dateMon 9 Jun 2014, 08:23 (12 years ago) parent2f93ad9
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--------------------------------------------------------------------------------