completed 'cons' and 'len' functions