Reputation: 21237
I'm just trying to get Clojure set up. Here is some code that I am trying to run in lein repl:
(def numbers (into [] (range 0 100)))
(sum numbers)
But I get this error:
CompilerException java.lang.RuntimeException: Unable to resolve symbol: sum in this context, compiling:(NO_SOURCE_PATH:1:1)
I don't know what this means. Is my installation wrong?
Upvotes: 1
Views: 163
Reputation: 107754
I'm not sure which sum
function you're trying to call, but you can use reduce
:
user=> (def numbers (into [] (range 0 100)))
#'user/numbers
user=> (reduce + numbers)
99
Upvotes: 1