invertList function

Invert the names and elements of a list