Display complete dependency tree with Leiningen

You can generate Maven’s POM out of Leiningen’s project definition and then use Maven’s dependency:tree plugin with a verbose option, like this: $ lein pom $ mvn dependency:tree -Dverbose=true This will list dependencies omitted for various reasons, e.g.: | +- ring:ring-core:jar:1.4.0:compile | | +- (org.clojure:clojure:jar:1.5.1:compile – omitted for conflict with 1.7.0) | | +- (org.clojure:tools.reader:jar:0.9.1:compile … Read more

Symbols in Clojure

General intro: Symbols in any Lisp are used as identifiers. If you’re going to refer to the value of a variable, say, you need to have a way of naming it; that’s what symbols are for. Remember that all Lisp code gets translated at read time to Lisp data structures; identifiers must also be represented … Read more

Why are Clojure stacktraces so long?

Replying to your numbered points, it is idiomatic in Clojure to interoperate directly with Java libraries, so getting the full Java stacktrace can be helpful if you are calling into Java objects in some unexpected or unsupported way. Sounds like a good idea; I’ve often at least wished for a settable option which would allow … Read more

What factors could determine whether Clojure, Scala or Haskell will gain traction?

On the top of my head: good IDE support (with refactoring) stable enough specifications clear policy about backward compatibility (in term of sources, binaries and behavior) frameworks and tools around the language (like code static analysis, code coverage, …) Scala, for instance, is still evolving and moving “too fast” to be “largely” used even though … Read more

Convert a sequence of strings to integers (Clojure)

You’re looking for Integer/parseInt. user=> (map #(Integer/parseInt %) [“1” “2” “3” “4”]) (1 2 3 4) You have to wrap Integer/parseInt in an anonymous function because Java methods aren’t functions. read-string would also work in this case: user=> (map read-string [“1” “2” “3” “4”]) (1 2 3 4) read-string reads any object from a string, … Read more

Explain Clojure Symbols

REPL = read eval print loop. Step through the read-eval process. READ: Clojure sees the string “(`a)”, parses it and ends up with a data structure. At read time, reader macros are expanded and not much else happens. In this case, the reader expands the backquote and ends up with this: user> (read-string “(`a)”) ((quote … Read more