One common problem we face when dealing with keyword list opts is 
validating options passed and setting default values to said keyword. 

This commonly yields code like:

def f(x, opts \\ []) do

opt_1 = opts[:opt_1] || :default_1
opt_2 = opts[:opt_2] || :default_2
...
end

Nx.Defn.Kernel has an useful helper for these cases 
(https://github.com/elixir-nx/nx/blob/c8353de695a3d70dc6d518e0ab2ec832faa7df68/nx/lib/nx/defn/kernel.ex#L741).

Perhaps this helper could be included in the Keyword module, along with a 
non-rasing version of some kind?

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/09f8df11-459a-44a6-aaf2-34462069d8ccn%40googlegroups.com.

Reply via email to