[erlang-questions] match specifications - find all matches

damien morton dmorton@REDACTED
Tue Nov 11 09:44:05 CET 2008


I'm trying to use compiled match specifications for an algorithm whereby I
want to find from a set of functions all possible functions that might match
a given message.
The idea is to extract the arguments pattern and guards from each function
and compile them all into one large match specification, with a
single MatchFunction corresponding to each function.

What I cant figure out is how to persuade the erlang:ms_test function to
return multiple possible matches - it only returns the first match.

Was thinking that I could use the trace functions somehow to do this, but
they don't seem to be available from the erlang_ms_test function.

If anyone has any pointers as to how to do this, they would be greatly
appreciated. I know I can run a series of match-specs one at a time, but I
expect that compiling them into one large match-spec will be more efficient.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081111/c98fd0f8/attachment.htm>


More information about the erlang-questions mailing list