Skip to content

Instantly share code, notes, and snippets.

@jabgibson
Created July 7, 2018 05:59
Show Gist options
  • Save jabgibson/232579d9f9604a0d77b1f3bbf80dc472 to your computer and use it in GitHub Desktop.
Save jabgibson/232579d9f9604a0d77b1f3bbf80dc472 to your computer and use it in GitHub Desktop.
Playing Haskell
-- firsthalf returns True if value is found in the first half of list ls
firsthalf value ls = elem val (reverse (drop (quot (length ls) 2) (reverse ls)))
-- subsek returns a subsection of list ls from start to end
subsek start end ls = drop start (reverse (drop (length ls - end) (reverse ls)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment