That is not append, it is prepend in both cases.
[a|b] is shorthand for prepend. Erlang (and many lisps) do not b to be a list. The result of prepending an element to an element is called an improper list. Most list manipulating functions assume a proper list and will break with an improper list, but the language itself does t prevent you from creating them anyway.
In the second case, we are prepending an element (a list) to another element (a single value), creating an improper list.
--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.