Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Java library to manipulate Clojure edn data structure? [closed]

Tags:

java

clojure

I am on a work to dynamically load Clojure functions from strings and parse them. Example:

Class.forName(RT.class.getName());
String fnText = "(defn foo [] (println \"foo1\"))";

PersistentList fnObj = (PersistentList) Clojure.read(fnText);
Symbol fnName = (Symbol) fnObj.get(1); // this is stupid
System.out.println(fnName.getName()); // prints "foo"

But fnObj.get(1) is not convenient. I am wondering is there a xpath like library in Java to manipulate the PersistentList returned from Clojure.read().

like image 645
Winter Young Avatar asked Feb 23 '26 10:02

Winter Young


1 Answers

There's this java library called edn-java. Not super active (last commit was Oct 2015).

FWIW, its on the recommended list here:

https://github.com/edn-format/edn/wiki/Implementations

like image 79
leeor Avatar answered Feb 25 '26 22:02

leeor