melpon/memoize

List argument causes argument error

Closed this issue · 2 comments

Hi, I tried to pass list as an argument, but was unsuccessful.
Can I pass list as an argument?

code

defmodule Sample do
  use Memoize
  defmemo my_fun(list) do
    list
  end
end

Sample.my_fun([1,2])

error

$ mix compile
Compiling 1 file (.ex)

== Compilation error in file lib/sample.ex ==
** (ArgumentError) argument error
    (stdlib) :ets.lookup(Memoize.CacheStrategy.Default, {Sample, :my_fun, [[1, 2]]})
    lib/memoize/cache.ex:99: Memoize.Cache.do_get_or_run/3
    (elixir) lib/kernel/parallel_compiler.ex:206: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

:memoize application is not started.

Try this:

defmodule Sample do
  use Memoize
  defmemo my_fun(list) do
    list
  end
end

Application.ensure_all_started(:memoize)
Sample.my_fun([1,2])

Hi, thank you.
Seems like I am totally newbie to elixir.