writing a "visitor pattern" in clojure is pretty easy if you have concrete types/classes: you write a protocol, and then extend-protocol all of the types you need. but it seems like it would be much messier in java: create an interface and then implement that interface directly on each class. is there a way to write a visitor without modifying the classes and without writing a big switch statement?
i guess extend-protocol is effectively a switch statement...
Depending on your Java, sealed interfaces or classes + switch