re-creating rust's vec!
macro in elixir, read about it here!
defmodule MyApp.DoStuff do
use ExVec, implementation: :rust
def len do
vec!(1..5) |> Enum.count()
end
def map_by_2 do
vec!(1..5) |> Enum.map(fn n -> n * 2 end)
end
end
If available in Hex, the package can be installed
by adding ex_vec
to your list of dependencies in mix.exs
:
def deps do
[
{:ex_vec, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ex_vec.