[erlang-questions] pattern match test operator

Bjorn Gustavsson <>
Tue Nov 20 07:07:40 CET 2007


"Matthew Dempsky" <> writes:

> On 11/19/07, Andras Georgy Bekes <> wrote:
> > [ X || X <- ListOrQLCTable,
> >         PATTERN1 ~= X orelse PATTERN2 ~= X]
> 
> Below you'll find a module that adds a parse transform so you can
> write expressions like '~'(Pattern = X) or match(Pattern = X).
> 
> A quick example:
> 
>     -module(test).
>     -compile({parse_transform, {match, '~'}}).
>     -export([foo/1]).

I don't recommend depending on the current implementation of
parameterized modules. A tuple was use for easy of prototyping,
with the intention of changing it to an opaque term to later.
Actually, we might make that change in one of the services
releases of R12B.

/Bjorn
-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list