For swapfl assumption is made that empty list and list with one
element will return false given they do not have first and last
element. This assumption is based on strict interpretation of
question that it needs to compare the first and last elements.
On this assumption base case is made with two elements
swapped, and inductive case with head and tail being different
but elements in between are same.
This allows to define swapfl in terms of itself, without any extra
helper functions.
For swapfl assumption is made that empty list and list with one element will return false given they do not have first and last element. This assumption is based on strict interpretation of question that it needs to compare the first and last elements. On this assumption base case is made with two elements swapped, and inductive case with head and tail being different but elements in between are same.
This allows to define swapfl in terms of itself, without any extra helper functions.