Using ETS Select To Form An Intersection
Posted
by Ruhi
on Stack Overflow
See other posts from Stack Overflow
or by Ruhi
Published on 2010-04-27T22:15:30Z
Indexed on
2010/04/28
0:33 UTC
Read the original article
Hit count: 341
i have the following ets structure:
SomeTable = ets:new(sometable, [bag]).
ets:insert(SomeTable, [
{set1,item1},
{set1,item2},
{set1,item3},
{set2,item1},
{set2,item2},
{set2,item4}]).
i want to get intersection of set1 and set2 using ets:select and fun2ms, result will be [item1, item2].
i spent hours and hours trying to accomplist it with ets:select and fun2ms with no success. can you help me out using ets:select and fun2ms?
thanks for all answers!
ps: i know about sets module, but i have to use ets and this exact data structure.
© Stack Overflow or respective owner