Add Function iter_domain, iter_range iterators.

Also, get rid of Function.iter_outputs.