Skip to content

Instantly share code, notes, and snippets.

@mtanzi
Created June 11, 2015 11:02
Show Gist options
  • Save mtanzi/0877b0d640019ed895a9 to your computer and use it in GitHub Desktop.
Save mtanzi/0877b0d640019ed895a9 to your computer and use it in GitHub Desktop.
Quick sort in elixir
defmodule Math do
def sort([h | t]) do
sort(for x <- t, x < h, do: x) ++ [h] ++ sort(for x <- t, x >= h, do: x)
end
def sort([]), do: []
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment