1

Syntax error when passing Java static method to Clojure function args directly:

(filter Character/isUpperCase "aBcD")

Why does it want the wrapper then work?

(filter #(Character/isUpperCase %) "aBcD")
0

1 Answer 1

1

Because filter takes a Clojure function as first argument, and one or more collections as rest.

A Java method is not a Clojure function. Wrapping the method in an anonymous function makes it one.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.