Change iter_range, and add iter_relation

Pretty sure I finally have the correct terminology here. The ordered
set of all "inputs" is the domain, and the ordered set of all "outputs"
is the range. A binary relation is the cartesian product of the domain
and range, an ordered set of (d, r) pairs.