I am struggling to define correctly the point-free version of the function, which adds 2 elements to the list.
It is easy to come up with a number of straightforward trivial implmentations:
addTwoElems :: a -> a -> [a] -> [a]
addTwoElems x y xs = x : y : xs
addTwoElems x y = (++) [x, y]
addTwoElems = (.) `on` (:) “ point free but with additional function
But how would a point-free composition (.) of the two list data constructors (:) look like?
Please not just show the correct function implementation, but please with explanations of the steps and logic behind how to come to the right version.
Per the comments, a step-by-step derivation that only uses
.and::