How to implement AND guards in list comprehensions? Separating the guards with comma seems to word as OR:
1> rd(r, {a, b}).
r
2> L = [#r{a = 1, b =2}, #r{a = 1, b = 3}].
[#r{a = 1,b = 2},#r{a = 1, b = 3}]
3> [X || X <- L, X#r.a =/= 1, X#r.b =/= 2].
[]
Thanks a lot.
That’s definitely an AND. The first element fails both tests; the second fails the
X#r.a =/= 1test.If you want OR, simply use the
orelseoperator: