Find the last element of a list. Assume the list is non empty.
Find the last but one element of a list. Assume the list has, at least, two elements.
Find the k-th element of a list. The first element in the list is number 1. Assume the list has, at least, k elements.
Find the number of elements of a list.
Reverse a list.
Find out whether a list is a palindrome.
Flatten a two-level nested list structure.
Eliminate consecutive duplicates of list elements.
Pack consecutive duplicates of list elements into sublists. If a list contains repeated elements they should be placed in separate sublists.
Run-length encoding of a list. Consecutive duplicates of elements are encoded as lists (n,e) where n is the number of duplicates of the element e.
Scoring
Each item scores 10 points.
Input
myLast [1..5] myLast "hello" myButLast [1..5] elementAt 3 [1..5] myLength [1..5] myReverse [1..5] isPalindrome "madam" myFlatten [[1..5],[3..4],[2..4]] compress "aaacaabb" pack "aaacaabb" encode "aaacaabb"
Output
5 'o' 4 3 5 [5,4,3,2,1] True [1,2,3,4,5,3,4,2,3,4] "acab" ["aaa","c","aa","bb"] [(3,'a'),(1,'c'),(2,'a'),(2,'b')]