 (defmethod eval-op :map
   [_ map-fn stream]
   `(.. ~(eval stream)
-       (map (reify KeyValueMapper
-              (apply [_ k# v#]
-                (apply key-value (~map-fn k# v#)))))))
+       (map (key-value-mapper ~map-fn))))
 
 (defmethod eval-op :map-values
   [_ map-fn stream]

(defmethod eval-op :select-key
  [_ map-fn stream]
  `(.. ~(eval stream)
       (selectKey (reify KeyValueMapper
                    (apply [_ k v]
                      (apply key-value (~map-fn k# v#)))))))

(defmethod eval-op :through
  [_ stream & args]

  [_ join-fn map-fn left right]
  `(.. ~(eval left)
       (join ~(eval right)
             `(key-value-map-fn ~map-fn)
             `(reify ValueJoiner
                (apply [_ left# right#]
                  (~join-fn left# right#))))))
