Syntactic v0.0.2 Syntactic
Provides some syntactic sugars
Summary
Macros
Expands to a keyword list with keys as atoms of given vars.
For example keys([name, age])
expands to [name: name, age: age]
Expands to a Map
with keys as atoms of given vars.
For example map([name, age])
expands to %{name: name, age: age}
Expands to a Map
with keys as strings of given vars.
For example maps([name, age])
expands to %{"name" => name, "age" => age}
Macros
Expands to a keyword list with keys as atoms of given vars.
For example keys([name, age])
expands to [name: name, age: age]
Useful in matches:
def full_name(keys(first_name, last_name)) do
first_name <> " " <> last_name
end
full_name(first_name: "Alan", last_name: "Parsons")
# => "Alan Parsons"
Expands to a Map
with keys as atoms of given vars.
For example map([name, age])
expands to %{name: name, age: age}
Useful in matches:
map(a, b) = %{a: 10, b: "Some Value"}
Expands to a Map
with keys as strings of given vars.
For example maps([name, age])
expands to %{"name" => name, "age" => age}