Changed dependencies so list now depends on iter.
Implemented better version of flat that uses an accumulator.