Sadly this doesn't all work yet, but the tests and xmap function are approximately correct. Eventually we add filter and reduce too!