use flattenIter from jsprim (cont)