modified declosurify to work on a sample general purpose List (mimicking
scala.collection.immutable.List)