implement list encoding for lecture exercises