I am just starting to dabble with :mnesia.select/1
and for the most part it works fine, but how can I get the equivalent of Kernel.in/2
?
For example this guard works and returns the correct results
[ {:==, :"$4", 10} ]
But this aborts with a :badarg message, because erlang has no in
(or maybe it does? I don’t know erlang)
[ {:in, :"$4", [10] } ],
So how should I write such a guard clause?
In the erlang docs, I see that erlang DOES have a :lists.member function, but I cannot understand how to use that here. [ {:"lists.member", :"$4", [10]} ]
does not appear to work, I’m not sure what syntax it is even expecting there.
According to the match spec docs, there is a set of built in functions, like ==, or map_get… But I see no way of asserting membership inside a list.