Merge pull request #2032 from cleishm/collection-type

Correct return type of empty literal collections
Use ArrayStack for tracking accumulation in tailrec folding

Improves performance substantially
Add MutableIdentityMap
rewrite: extract parameters from literals
Add test