This is correct, assuming the list is size 1 or 2, but the length isn't checked. How about using a List of length 1, 2 or 3 and then using pattern matches that also ensure the length is correct?
````
case x::y::Nil =>
case x::Nil =>
case Nil =>
````