Inverse match on ets?

Tim Bates <>
Mon Oct 10 13:37:37 CEST 2005


Hi folks,
I want to be able to store patterns in an ets table and retrieve those 
that match a given example, like this eg:

Stored in ets:
{{record, a, '_'}, <0.57.0>}
{{record, b, '_'}, <0.59.0>}
{{record, '_', 7}, <0.62.0>}

get_matching_pids({record, a, 7}) -> [<0.57.0>, <0.62.0>]

Sort of like a match-spec but in reverse, where the unbound elements are 
in the table. Any suggestions on how I might implement get_matching_pids/1?

Thanks,
Tim.

-- 
Tim Bates




More information about the erlang-questions mailing list