Create A List Of Atoms
The ~w
sigil makes it easy to create a word list -- a list of strings -- where each word is separated by a space.
> ~w(bulbasaur charmander squirtle)
["bulbasaur", "charmander", "squirtle"]
By appending an a
onto that sigil construct, you are instructing Elixir that you would instead like a list of atoms.
> ~w(bulbasaur charmander squirtle)a
[:bulbasaur, :charmander, :squirtle]
Last updated
Was this helpful?