Power-dot: enhanced Java interop that allows you to treat Clojure functions as Java lambdas

I’ve just released a new Clojure library named power-dot.

It provides an enhanced Java interop feature that allows you to treat Clojure functions as Java lambdas.
Using power-dot, you can write code like:

(require '[power-dot.core :as dot])

(dot/.. (IntStream/range 0 10)
        (filter even?)
        (map #(* % %))
        (forEach println))

instead of:

(.. (IntStream/range 0 10)
    (filter (reify IntPredicate (test [_ x] (even? x))))
    (map (reify IntUnaryOperator (applyAsInt [_ x] (* x x))))
    (forEach (reify IntConsumer (accept [_ x] (println x)))))

Give it a try!

5 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.