Search code examples
javaclojureclojurescriptleiningenread-eval-print-loop

RuntimeException when using queue literal in REPL


So I'm just beginning my clojurescript experience, and following along with the clojurescript-unraveled web book to get down the basics. Been a smooth process mostly, but I've hit a snag using the #queue [] literal. I'm using alein repl running Clojure 1.8.0, Java 1.8.0_112-b16, and Leiningen 2.7.1.

When I put in the following input:

(def pq #queue [1 2 3])

I get this stacktrace:

RuntimeException No reader function for tag queue  
clojure.lang.LispReader$CtorReader.readTagged (LispReader.java:1245)
RuntimeException Unmatched delimiter: )  
clojure.lang.Util.runtimeException (Util.java:221)

I've tried the #js tag literal as well, and got the same No reader function for tag ... exception. However, the UUID and instance of time literals work as expected with no runtime errors.

I'm in the process of digging into this problem and am now in the realm of exploring the broader topics of the edn spec and the cljs.reader implementation, but I'm not making a whole lot of progress on solving the original problem. Any insight on why this exception is/might be occurring would be much appreciated.

Thanks.


Solution

  • The #queue literal only exists in ClojureScript, so a REPL with Clojure proper cannot resolve it. Other (e.g., #uuid) literals exist in both. Since the common literals work, but #queue does not, this would suggest that you are in fact running a Clojure REPL instead of CLJS REPL.

    clojurescript-unraveled provides instructions for setting a REPL with Nashorn, Node.js, or Browser. Another option is to use a figwheel REPL, which connects to a browser.