pattern match in Erlang
问题 I am trying to learn some Erlang while I got stuck on these several Erlang pattern matching problems. Given the module here: -module(p1). -export([f2/1]). f2([A1, A2 | A1]) -> {A2, A1}; f2([A, true | B]) -> {A, B}; f2([A1, A2 | _]) -> {A1,A2}; f2([_|B]) -> [B]; f2([A]) -> {A}; f2(_) -> nothing_matched. and when I execute p1:f2([x]) , I received an empty list which is [] . I thought it matches the 5th clause? Is that a literal can also be an atom? When I execute p1:f2([[a],[b], a]) , the