I’m new on Elixir and I want to know how to use properly recursion on Lists.
defmodule Make do
@my_head = [1]
def create(1) do
@my_head
end
def create(N) do
@my_head = [head | create(N-1)]
end
end
I want @my_head to be the list [1] and concatenate that list with other values without using module list functions. The problem is that I don’t know how to define a variable list inside my module Make to
concatenate it with other values.