Sunday, October 4, 2015

"java.lang.RuntimeException: Reader tag must be a symbol" Clojure

Very quick blog post because I couldn't see this anywhere on the top page of results:

If you're learning clojure, and you get this error
'java.lang.RuntimeException: Reader tag must be a symbol'

check if you're putting whitespace between # and ( in an anonymous function literal. Don't do that. 


(If it was something else causing that error for you, please add it to the comments when you work it out)

1 comment:

  1. Like many Clojure REPL errors I've noticed - especially around parsing - that is indeed completely horrible. It seems that everything starting with a # is a "Reader macro", a kind of extension of the language.

    A not-great doc about this - have a look at the introduction & then jump to section "Dispatch" -
    http://clojure.org/reader

    Again, you shouldn't need to know all that to read an error about whitespace. :o\

    ReplyDelete