Skip to content

Instantly share code, notes, and snippets.

@yelouafi
Created July 17, 2015 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yelouafi/96ac30a00671b1ff9fb0 to your computer and use it in GitHub Desktop.
Save yelouafi/96ac30a00671b1ff9fb0 to your computer and use it in GitHub Desktop.
span :: (a -> Bool) -> [a] -> ([a],[a])
span _ this@[] = (this, this)
span p this@(x:xs)
| p x = let (ys,zs) = span p xs in (x:ys,zs)
| otherwise = ([],this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment