Pattern Match and ++ operator
Today I learned that ++
operator should not be used on pattern matching.
This works with Lists of integers, but fails on compilation time for other content type.
[1] ++ [2] = [1, 2] #=> [1, 2]
[:foo] ++ [:bar] = [:foo, :bar] #=> ** (CompileError): illegal pattern
[foo: 1] ++ [bar: 2] = [foo: 1, bar: 2] #=> ** (CompileError): illegal pattern
Tweet