Skip to content

Instantly share code, notes, and snippets.

@klapaucius
Created April 30, 2014 10:58
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 klapaucius/3823d3ccda55a1bef365 to your computer and use it in GitHub Desktop.
Save klapaucius/3823d3ccda55a1bef365 to your computer and use it in GitHub Desktop.
Prelude> let foo ys | (xs:_) <- reverse ys = case xs of xs' | (x:_) <- reverse xs' -> x
Prelude> foo [[1..3],[4..7],[8..10]]
10
Prelude> let foo' (reverse -> (reverse -> x:_):_) = x
Prelude> foo' [[1..3],[4..7],[8..10]]
10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment