Writing Your Own Sigils
Lowercase sigils interpolate their parameters, uppercase sigils do not.
User-defined sigils are not globally available. Need to be imported. Reduces the risk of running into a system-defined sigil.
Multi-app Umbrella Projects
There seems to be some community disagreement about umbrella projects. My basic understanding is that it is likely not something I should consider except for extremely large and/or complex projects.
MoreCoolStuff-1
Write a ~v
sigil that parses multiple lines of csv data.
Return a list of lists.
defmodule CsvSigil do
@doc """
Implement the `~v` sigil to parse rows of comma-separated data into a list of lists.
Ignore any spaces before commas and trailing commas.
Allows interpolation.
## Example usage
iex> import CsvSigil
iex> ~v"""
...>1,2,#{3}
...>cat,dog
...>"""
[["1","2","3"], ["cat","dog"]]
"""
def sigil_v(lines, _opts) do
lines
|> String.trim_trailing
|> String.split("\n")
|> Enum.map(fn x -> String.split(x, ",") end)
end
end