Skip to content

Instantly share code, notes, and snippets.

@Raynes
Created November 16, 2009 22:33
Show Gist options
  • Save Raynes/236383 to your computer and use it in GitHub Desktop.
Save Raynes/236383 to your computer and use it in GitHub Desktop.
middleList xs@(_:_:_:_) =
let n = length xs
en = if n < 5 then 1 else 2 * (n `div` 4)
in take (if odd n then 1 else 2) $ drop en xs
middleList xs = xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment