Skip to content

Instantly share code, notes, and snippets.

@aglassman
Last active June 21, 2023 15:56
Show Gist options
  • Save aglassman/1181fc7d620dc7f96820163b6c86a566 to your computer and use it in GitHub Desktop.
Save aglassman/1181fc7d620dc7f96820163b6c86a566 to your computer and use it in GitHub Desktop.
Elixir Todo Golf
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)))
@aglassman
Copy link
Author

l = list, a = add, c = complete, x = exit

@mvelebit
Copy link

Yes officer, this man right here

@aglassman
Copy link
Author

@mvelebit 😆 Lock me up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment