I am searching for Kotlin alternative to:
(cons 1 '(2 3))
in lisp or
1 : [2, 3]
in haskell or
1 :: List(2, 3)
in scala,
(which all result in sth like [1, 2, 3])
so I can prepend an element to a List<T>
(or any other list you can offer).
It will also be fine if one could provide O(1) head
and tail
Kotlin alternatives (I've found just first()
)