ETS tuple in body

Roberto Ostinelli ostinelli@REDACTED
Fri Jan 10 16:37:42 CET 2020


Dear list,
Something I probably should know better of. In ETS, if one of your
MatchBody is a tuple, it needs to be wrapped as a tuple:

    MatchBody = case is_tuple(Name) of
        true -> {{{Name}, '$2', '$3', '$4'}};
        _ -> {{Name, '$2', '$3', '$4'}}
    end,
    case ets:select(my_table, [{
        {Name, '$2', '$3', '$4', '_', '_'},
        [],
        [MatchBody]
    }])

I need to do this because to make it work for Name values of both test and
{test}.
Is there a better way?

Thank you,
r.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200110/73e91362/attachment.htm>


More information about the erlang-questions mailing list