On Jul 15, 2009, at 9:59 PM, minh thu wrote:

2009/7/15 Magicloud Magiclouds <magicloud.magiclo...@gmail.com>:
Hi,
I do not notice this before. "fun ([0, 1] ++ xs) = .." in my code
could not be compiled, parse error.

++ is a function; you can't pattern-match on that.

Doesn't matter, it's not trying to.
Part of Erlang syntax is that in a pattern
        [c1,...,cn] ++ P
is equivalent to
        [c1,...,cn|P]

For example,
        wee(X) ->
            F = fun ([0,1] ++ L) -> L end,
            F(X).
is perfectly legal.

The problem might be the "xs", or it might be the "=".
Presumably it should be

        fun ([0,1] ++ Xs) -> ...
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to