I'm new to Haskell so I apologize if this is an easy question, but I couldn't find an answer anywhere.
What I would like to do is grab the first and last element of a list and return those in a new list.
I know that head [1,2,3,4] will return 1, and I know that last [1,2,3,4] will return 4. But how would I go about placing those two results into a list such as: [1,4]?
Thanks.
(1,4)instead of[1,4]