Convert Clojure expression to bytecode


I’ve been looking for an API I can use in the REPL to better understand Clojure’s compiler. What I’m hoping to find is something where I can pass it a quoted form, and get the bytecode back.

  '(def x (fn [x] (+ x y))))

       0: ldc           #34                 // String user              
       2: ldc           #36                 // String x       
       4: invokestatic  #42                 // Method clojure/lang/RT.var:(Ljava/lang/String;Ljava/lang/String;)Lclojure/lang/Var;

Does something like this exist?


Perhaps one of the following?

The latter outputs Java source code, though.


clj-java-decompiler can output bytecode too. Just use disassemble function instead of decompile.

For larger functions the Java output is much more readable though.