Map and xor functions that use foldr for iteration