[a: “1”, b: “2”]
results in
[a: “1”, b: “2”]
but
[1, a: “1”, b: “2”]
results in
[1, {:a, “1”}, {:b, “2”}]
Why?
[a: “1”, b: “2”]
results in
[a: “1”, b: “2”]
but
[1, a: “1”, b: “2”]
results in
[1, {:a, “1”}, {:b, “2”}]
Why?
Looks like two different syntaxes for the same thing: https://tio.run/##S83JrMgs@v/f018vM6@4IDW5RCHaUEeh2ipRR8GwFsRI0lEwqo1VsLUFSyRaKQDJJCsFo9j//wE
[a: "1"]
is just sugar syntax to represent keyword lists, e.g. [{:a, "1"}]
.
If you have another element different than {atom, term}
it will print weirdly, as in normal list, not keyword list anymore.
what typo? (oops, just seen it )