Last active
February 9, 2016 15:29
-
-
Save sashaafm/a2924c2cb3a4b95c9189 to your computer and use it in GitHub Desktop.
gfe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defp gfe([]), do: nil | |
defp gfe(queue) do | |
{_, front_elem} = queue | |
|> Enum.group_by(fn {_, prio} -> prio end) | |
|> Map.to_list | |
|> List.last | |
{List.last(front_elem), queue -- [List.last(front_elem)]} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment