Skip to content

Instantly share code, notes, and snippets.

@craigp
Created May 5, 2017 16:56
Show Gist options
  • Save craigp/e7902635ffbb3ad58a99986e70f871af to your computer and use it in GitHub Desktop.
Save craigp/e7902635ffbb3ad58a99986e70f871af to your computer and use it in GitHub Desktop.
defmodule Quicksort do
def sort([]), do: []
def sort([head|tail]) do
{low, high} = Enum.partition(tail, &(&1 < head))
sort(low) ++ [head] ++ sort(high)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment