Skip to content

Instantly share code, notes, and snippets.

@hiroshi-maybe
Created May 1, 2013 08:49
Show Gist options
  • Select an option

  • Save hiroshi-maybe/5494371 to your computer and use it in GitHub Desktop.

Select an option

Save hiroshi-maybe/5494371 to your computer and use it in GitHub Desktop.
A function to check sublist.
isSublist :: (Eq a) => [a] -> [a] -> Bool
isSublist [] _ = True
isSublist _ [] = False
isSublist (x:xs) ys = case dropWhile (/=x) ys of
[] -> False
(x:rest) -> isSublist xs rest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment