A custom list implementation in Scala