varmapToList function

Converts the varmap to a list