Fork me on GitHub
#beginners
<
2022-06-03
>
Bhougland12:06:55

How is it that namespaces give me so much trouble as a beginner? here is my project.clj:

pavlosmelissinos13:06:16

Please try to keep your questions in a single comment or use threads to break them down Let's rule out the obvious. Did you start your repl after you added incanter as a dependency in project.clj?

pavlosmelissinos13:06:35

Oh nevermind, I didn't read the error carefully. It's in an incanter namespace, that's a bit weird :thinking_face:

Bhougland12:06:22

:dependencies [[org.clojure/clojure "1.11.1"]
               [org.apache.poi/poi-ooxml "5.2.0"]
               [scicloj/tablecloth "6.076"]
               [metosin/loiste "1.1.2"]
               [juji/editscript "0.5.8"]
               [aero "1.1.6"]
               [incanter/incanter-excel "1.9.3"]]

🧵 2
Bhougland13:06:26

Here is my core project file :

🧵 1
Bhougland13:06:33

(ns dmf.core
  (:require [dmf.excel :as xls]
            [dmf.utility :as ut]
            [editscript.core :as e]
            [loiste.core :as xl]
            [tablecloth.api :as tc]
            [incanter.excel :as ie]))

🧵 1
Bhougland13:06:49

repl gives me this error: Syntax error compiling at (incanter\excel.clj:1:1). namespace 'incanter.excel.cells' not found

🧵 1
Bhougland13:06:36

Here is the incanter library structure:

🧵 1
rolt13:06:43

it's probably a conflict with poi version

Bhougland13:06:23

That might be it, I am testing various excel libraries to see which one I like best.

rolt13:06:14

incanter still uses 3.16, that's 2 major versions and there are a lot of breaking changes

rolt13:06:45

try using them one at a time, no good solution unfortunately

Bhougland13:06:42

Thanks for the help, I have spent so much time looking thorugh namespace information

rolt13:06:13

welcome to dependency hell 😉

jumar13:06:22

When I try to manually compile incanter.excel.cells ns (using your project setup) I get this

2. Unhandled clojure.lang.Compiler$CompilerException
   Error compiling /Users/jumar/.m2/repository/incanter/incanter-excel/1.9.3/incanter-excel-1.9.3.jar:incanter/excel/cells.clj at (25:16)
   #:clojure.error{:phase :compile-syntax-check,
                   :line 25,
                   :column 16,
                   :source
                   "/Users/jumar/.m2/repository/incanter/incanter-excel/1.9.3/incanter-excel-1.9.3.jar:incanter/excel/cells.clj"}
             Compiler.java: 6825  clojure.lang.Compiler/analyze
             Compiler.java: 6762  clojure.lang.Compiler/analyze
...
             Compiler.java: 7122  clojure.lang.Compiler/analyzeSeq
             Compiler.java: 6806  clojure.lang.Compiler/analyze
             Compiler.java: 7191  clojure.lang.Compiler/eval
             Compiler.java: 7653  clojure.lang.Compiler/load
                      REPL:    1  incanter.excel.cells/eval43855
                      REPL:    1  incanter.excel.cells/eval43855
             Compiler.java: 7194  clojure.lang.Compiler/eval
             Compiler.java: 7149  clojure.lang.Compiler/eval
                  core.clj: 3215  clojure.core/eval
                  core.clj: 3211  clojure.core/eval
    interruptible_eval.clj:   87  nrepl.middleware.interruptible-eval/evaluate/fn/fn
                  AFn.java:  152  clojure.lang.AFn/applyToHelper
                  AFn.java:  144  clojure.lang.AFn/applyTo
                  core.clj:  667  clojure.core/apply
                  core.clj: 1990  clojure.core/with-bindings*
                  core.clj: 1990  clojure.core/with-bindings*
               RestFn.java:  425  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   87  nrepl.middleware.interruptible-eval/evaluate/fn
                  main.clj:  437  clojure.main/repl/read-eval-print/fn
                  main.clj:  437  clojure.main/repl/read-eval-print
                  main.clj:  458  clojure.main/repl/fn
                  main.clj:  458  clojure.main/repl
                  main.clj:  368  clojure.main/repl
               RestFn.java: 1523  clojure.lang.RestFn/invoke
    interruptible_eval.clj:   84  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:   56  nrepl.middleware.interruptible-eval/evaluate
    interruptible_eval.clj:  152  nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
                  AFn.java:   22  clojure.lang.AFn/run
               session.clj:  218  nrepl.middleware.session/session-exec/main-loop/fn
               session.clj:  217  nrepl.middleware.session/session-exec/main-loop
                  AFn.java:   22  clojure.lang.AFn/run
               Thread.java:  833  java.lang.Thread/run

1. Caused by java.lang.RuntimeException
   Unable to find static field: CELL_TYPE_NUMERIC in interface org.apache.poi.ss.usermodel.Cell

1
rolt13:06:51

note that there are ways to "shade" depencencies to avoid conflicts but this is definitively non trivial

Trev21:06:53

clojure
(ns tutorial.dealership
  (:require [clojurewerkz.money.amounts :as ma]
            [clojurewerkz.money.currencies :as cu]
            [clojurewerkz.money.format :as mf])
  (:import java.util.Locale))

; ...

(defn format-usd
  [price]
  (str (mf/format (ma/amount-of (cu/of-country "US") price) (Locale/US))))
Pretty prices!
Here are the affordable options for Jack Forge:
A Fiat for $20,000.00
Coupon code THATS10K is not valid.