[erlang-questions] Pass a pattern to a function

Sten Gruener <>
Tue Feb 10 18:08:16 CET 2009


Hello,

I try to write a function to scan the message queue and discard matched
messages.

Like this:

discard(Pattern) ->
    receive
        Pattern ->
            discard(Pattern)
    after 0 ->
        ok
    end.

the problem is, that I cannot call discard({_, {msg}}) since _ is a wildcard
representation. Are there any solutions?

Regards,
Sten Gruener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090210/2e2fd8b8/attachment.html>


More information about the erlang-questions mailing list