Skip to content

Instantly share code, notes, and snippets.

@chiroptical
Last active June 26, 2025 15:58
Show Gist options
  • Save chiroptical/bc2e85b9bd7bc2f18982d2a68855644b to your computer and use it in GitHub Desktop.
Save chiroptical/bc2e85b9bd7bc2f18982d2a68855644b to your computer and use it in GitHub Desktop.
Quick impl of odd evens (probably not the most efficient version)
oddEven :: [Int] -> [Int]
oddEven inp =
let (x, y) =
foldr
( \v (odds, evens) ->
if v `mod` 2 == 0
then (odds, (v : evens))
else ((v : odds), evens)
)
([], [])
inp
in x <> y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment