Advanced ETS Pattern Matching

Eric Newhuis <>
Mon Jan 6 17:28:10 CET 2003


(My Trie has morphed into consideration of ETS pattern matching.)
 
Does anyone know if ETS can support pattern matching on "the rest of a
list of terms" if the key is a list of terms?
 
All my keys are lists.  I need to match on parts of the key and on the
elements near the head of the list.
 
Examples:
 
Given keys:
 
[a,b,c,d]
[a,b,c]
[a,b]
 
Find all three with the following pattern:
 
[a,'*']
 
Find the last two with this pattern:
 
[a,b,'*']
 
Find [a,b] with this pattern:
 
['_',b]
 
etc.
 
I think the '_' works.  But is there a mechanism like '*' that can match
the rest of an arbitrary length key that is a list, sort of like _='_'
in some other database module?
 
I know I could keep track of the maximum list length and perform
multiple queries appending '_' to the maximum length.  But that seems
yucky.
 
Sincerely,
Eric
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20030106/6ee2a5eb/attachment.html>


More information about the erlang-questions mailing list