Skip to content

Instantly share code, notes, and snippets.

@ccarvalho-eng
Created February 7, 2023 13:34
Show Gist options
  • Save ccarvalho-eng/3e5659a9e6c909f38d5bea497f7c9236 to your computer and use it in GitHub Desktop.
Save ccarvalho-eng/3e5659a9e6c909f38d5bea497f7c9236 to your computer and use it in GitHub Desktop.
-module(all_atoms).
-export([all_atoms/0]).
atom_by_number(N) ->
binary_to_term(<<131,75,N:24>>).
all_atoms() ->
atoms_starting_at(0).
atoms_starting_at(N) ->
try atom_by_number(N) of
Atom ->
[Atom] ++ atoms_starting_at(N + 1)
catch
error:badarg ->
[]
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment