Last active
June 21, 2023 15:56
-
-
Save aglassman/1181fc7d620dc7f96820163b6c86a566 to your computer and use it in GitHub Desktop.
Elixir Todo Golf
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
Enum.reduce(Stream.cycle(0..1), [], &(IO.inspect(case String.trim(IO.binread(:line)) do | |
"l" <> _ -> &1; &2 | |
"a " <> i -> [{i, nil} | &2] | |
"c " <> i -> Enum.map(&2, fn {^i, _} -> {i, true }; x -> x end) | |
"x " <> i -> Enum.reject(&2, fn {^i, _} -> true; _ -> false end) | |
_ -> raise "e" | |
end))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
l = list, a = add, c = complete, x = exit