Hello,
There are some points to clarify in your code…
- ’ is not equal to ", the first define a charlist, the second is a binary
- ‘cat’ is a charlist, or a list of char if You prefer… and ‘dog’ is equal to [100, 111, 103]
- to get the value of a character, You can use ?, eg. ?a => 97
- a list is composed by a head and a tail, it is a linked list where head is an element, and tail is a list
What You really wanted is
iex> [?c, ?a, ?t | 'dog']
'catdog'
# This is also equal to
iex> [?c | [?a | [?t | 'dog']]]
'catdog'
# it's more common to use binary in Elixir
iex> "cat" <> "dog"
"catdog"
Don’t worry, we all have gone through this
I recommend this page to dig deeper
https://elixir-lang.org/getting-started/binaries-strings-and-char-lists.html