manipulate collections in a pseudo-functional and statically typed way