[arrays] Appending an element to the end of a list in Scala