Question: 4. Write a Haskell function reorder :: [a] => [a] such that reorder xs returns the list obtained by switching the order of suc- cessive
![4. Write a Haskell function reorder :: [a] => [a] such](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f2e45962cee_20066f2e458d855c.jpg)
4. Write a Haskell function reorder :: [a] => [a] such that reorder xs returns the list obtained by switching the order of suc- cessive pairs of elements of xs (i.e., the first and second items are switched, the third and fourth items are switched, and so on). When xs has an odd number of elements, the last item retains its original position. For example, the function should have the following behavior: *Main> reorder [10,20,30,40,50,60,70] [20,10,40,30,60,50,70] *Main > reorder ["one","two","three","four"] ["two","one","four", "three"]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
