Created
February 7, 2023 13:34
-
-
Save ccarvalho-eng/3e5659a9e6c909f38d5bea497f7c9236 to your computer and use it in GitHub Desktop.
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
-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