a general list traversal function
traverse(listname)