Write a function lastElem that
returns the last element of a list.
> lastElem [2, 4, 6, 8] 8
Write a function secondLast that
returns the second-to-last element of a list.
> secondLast [2, 4, 6, 8] 6
Write a function kth k l that returns
the kth element of a list l, where elements are numbered starting
from 0. (Do not use the built-in operator !!, which does
the same thing.)
Write a function del n l that deletes
the first occurrence of an integer n from a list of integers l,
returning a new list. If n is not present in the list, the function
should return l unchanged.
Write a function is_pow2 that
determines whether a non-negative integer is a power of 2.
Write a function bitCount that takes
a non-negative Integer and returns the number of ones in its binary
representation.
Write a function log2 that takes a
positive integer n and returns ⌊log2(n)⌋, where ⌊x⌋
denotes the floor function, i.e. rounding down to the nearest
integer.
Write a function rev :: [a] -> [a]
that reverses a list of any type. What is your function's running
time as a function of N, the length of the input list?
Write a function before that takes
two strings s and t and returns True if s comes before t in
dictionary order. In your function, you may use the operator < on
characters, but not on strings.
Write a function dedup that
eliminates consecutive duplicate elements in a list of
integers:
> dedup [2, 4, 4, 4, 6, 6, 8, 4] [2, 4, 6, 8, 4]
Which of these functions is equivalent to the
built-in operator || ?
my_or
	a
	b
	=
	a
	||
	b
my_or
	a
	b
	=
	b
	||
	a
my_or
	_
	True
	=
	True
my_or
	True
	_
	=
	True
my_or
	_
	_
	=
	False
my_or
	True
	False
	=
	True
my_or
	True
	True
	=
	True
my_or
	False
	True
	=
	True
my_or
	False
	False
	=
	False
Construct an infinite list containing all Fibonacci numbers: 1, 1, 2, 3, 5, 8, 13, ...
Solve Project Euler's problem 2.
Write a function that determines whether an integer is prime.
Construct an infinite list containing all prime numbers.
Solve Project Euler's problem 3.
Write a function that determines whether an Integer is a palindrome. For example, 46264 is palindromic. Do not use any strings in your solution.