I'm currently working through "Clojure Data Analysis Cookbook" by Eric Rochester and have encountered an issue with namespace conflicts involving the abs function. I set up my project using Leiningen and included dependencies for incanter (version 1.9.3). However, when I try to require the incanter.core and incanter.io namespaces in my REPL, I get a series of warnings about the abs function being redefined.
Here's what I did:
Created a new project with
lein new data-eric
.Added Incanter dependencies to
project.clj
:[incanter/incanter-core "1.9.3"] [incanter/incanter-io "1.9.3"]
Started a REPL in VS Code command + shift + P: Start a Project REPL and Connect -> Leiningen
and ran the following commands:
(require '[incanter.core :as ic]
'[incanter.io :as io])
This resulted in multiple warnings, all related to the abs function being redefined in various namespaces, such as clojure.core.matrix.impl.mathsops, clojure.core.matrix.protocols, and incanter.core.
Example Warning:
WARNING: abs already refers to: #'clojure.core/abs in namespace: clojure.core.matrix.impl.mathsops, being replaced by: #'clojure.core.matrix.impl.mathsops/abs
I understand that this is due to the abs function existing in multiple namespaces, but I'm unsure about the best way to handle these warnings. Should I be concerned about these warnings affecting the functionality of my project? Is there a recommended approach to resolve or work around this issue?
Any guidance or suggestions would be greatly appreciated. Thank you in advance!
Those warnings aren't for you, exactly - they're for the authors of
clojure.core.matrix.impl.mathsops
, and as far as the compiler knows, that might be you. core.matrix was updated to address these warnings a year and a half ago, but that doesn't exactly help you: Incanter is old and hasn't been updated at all in the last five years, so it's depending on an old version of core.matrix. I would ignore these error messages: if you are really keen you could probably find a way to depend on a newer version of core.matrix while still using the old Incanter, but the version skew would come with its own risks.