[erlang-questions] erlang *****

Vlad Dumitrescu vladdu55@REDACTED
Fri Mar 14 14:34:14 CET 2008


Hi,

On Fri, Mar 14, 2008 at 12:57 PM, Andras Georgy Bekes <bekesa@REDACTED> wrote:
>  Why don't we extend the notion of patterns to somehow describe the union
>  set operation?

That's a very good idea, I think. I mean not only the union operation,
but the whole proposal. Maybe you should prepare an EEP -- pattern
matching is one of the main strengths of Erlang as a language and
improving it would affect positively all the code base. [and it's a
backward-compatible change]

I see a couple of additional (future) steps:

** Since something new is added to the language, we could look at
removing something: the guards, by allowing inlined guard expressions
in the pattern itself, like for example
    {integer(X), _, X>3, atom(Y), Z!=[X,Y]}
or
    {integer(X>3), _, X, atom(Y), Z!={X,Y]}
would be equivalent to
    {X, _, X, Y} when is_integer(X), X>3, is_atom(Y), not(Z ~=[X, Y]).


** And from here I think only the '?' and '*' operators (i.e. the
optional marker and the Kleene closure) are missing in order to get a
pattern language with full regular expression power. But that can wait
for a little while, maybe :-)

best regards,
Vlad

-- 
Some people see things that are and ask, Why?
Some people dream of things that never were and ask, Why not?
Some people have to go to work and don't have time for all that.
--- George Carlin



More information about the erlang-questions mailing list