Initial work on #618.

@garyb @joneshf I think this is good to go, other than adding a few more tests. Could you please review?
Well `flip (,)` but yes.