Fork me on GitHub

The commnd clj how to get it’s version?

Alex Miller (Clojure team)03:07:26

the most recent is


Hi folks, My first Q on here. So pardon if I don't get the format of asking correct. I have a small project that uses hugsql to get rows of data from a DB table. Now my problem is not being able to test my code repl, I am using IntelliJ + Cursive. Here is how my code partial looks

(defprotocol ETLJob
  (exec [this])

(defrecord ETLJobImpl [big-query dw-db]
  (exec [this]
    (f/attempt-all [_ (println  "Getting DB records")
                    dw-records (oracle-db/get-debtor-profile-records dw-db)
(prn dw-records)] 

;calling the get-debtor-profile-records from my comment

  (let [dw-db (:boundary/dw-db integrant.repl.state/system)]
     (oracle-db/get-debtor-profile-records dw-db))       *;; Running this line gives me dev=> (let [dw-db (:boundary/dw-db integrant.repl.state/system)] (oracle-db/get-debtor-profile-records dw-db))
dev=> CompilerException java.lang.IllegalArgumentException: No implementation of method: :get-debtor-profile-records of protocol:*

   (exec (:job/etl integrant.repl.state/system)) *;RUnning this line alone doesn't work gives me dev=> (exec (:job/etl integrant.repl.state/system)) CompilerException java.lang.IllegalArgumentException: No implementation of method: :exec of protocol: #'scg.job.etl/ETLJob found for class: nil, compiling:*

Any idea how I can test my code within repl. I am just in the dev ns right now that should load all my duct config. PS: Since this is my unit test I have setup all the values needed for the duct config in my ENV variables.


I guess (:job/etl integrant.repl.state/system) returns nil?


It returns CompilerException java.lang.IllegalArgumentException: No implementation of method: :exec of protocol:


You saw I chopped exec out? What does your (defmethod init-key :job/etl look like?


Oh, sorry. Yes. (:job/etl integrant.repl.state/system) returns nil


That looks like

(defmethod ig/init-key :job/etl
  [_ deps]
    (map->ETLJobImpl deps)


Did you (go)? To initialise the integrant-REPL system


dev=> (go)
dev=> IllegalArgumentException No method in multimethod 'init-key' for dispatch value: :boundary/big-query  clojure.lang.MultiFn.getFn (


Well, that's another problem. Does (:job/etl integrant.repl.state/system) return something now?


Still gives me nil even after I removed the :boundary/big-query from the config


Try (reset)? Then the thing again


Thx, cleaned up my dev.edn of :boundary/big-query and now (:job/etl integrant.repl.state/system) works


Any luck with exec now then?


dev=> (exec (:job/etl integrant.repl.state/system))
dev=> CompilerException java.lang.IllegalArgumentException: No implementation of method: :exec of protocol: #'scg.job.etl/ETLJob found for class: scg.job.etl.ETLJobImpl, compiling:


Still gives me that error


ah but the class is right now, because at least you're calling it on a value now


Yes...seems like I can just run the line

(oracle-db/get-debtor-profile-records dw-db)


Is there some docs on how to use duct and integrant with repl?


Thx for your help so has gotten me further along

👍 4

So there needs to be a (defmethod ig/init-key....) for every :boundary/abc inside the *.edns?


Yep think so; I guess you could (defmethod init-key :default) if you want to allow configuration of components you don't have. Can't see a reason to though

👍 4

bear in mind (reset) reloads from disk, so if you've eval'd stuff in from an editor session, that will get overwritten


I've not used Duct


Thx...I thought duct & integrant are used together...but seems I am using mostly IG only.

Ashley Smith10:07:34

Good morning everyone. I posted something in #figwheel-main but I didn't get any answers so I was wondering if anyone could help. I have a deps.edn file that looks like this:

{ :deps { org.clojure/clojure       {:mvn/version "1.9.0"}
          org.clojure/clojurescript {:mvn/version "1.10.339"}
          ring/ring-core            {:mvn/version "1.7.1"}
          ring/ring-jetty-adapter   {:mvn/version "1.7.1"}
          compojure                 {:mvn/version "1.6.1"}
          reagent                   {:mvn/version "0.8.1"}
          re-frame                  {:mvn/version "0.10.8"}}
  :paths ["src" "resources"]
  :aliases { :depstar
              { :extra-deps
                {seancorfield/depstar {:mvn/version "0.2.4"}}}
              { :extra-deps
                { com.bhauman/figwheel-main       {:mvn/version "0.1.9"}
                  com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}}
                :extra-paths ["target" "test" "resources"]}
            :build {
              :main-opts ["-m" "figwheel.main" "-b" "dev" "-r"]}}}
I've got a front end and a back end in the same project. I had the front end working well with figwheel-main, and the backend was undeveloped. I've done some work on the backend and added the ring dependencies and compojure, and all of a sudden my CLJS front end will not compile. If I comment out ring/ring-jetty-adapter everything compiles, so I was wondering why simply listing a dependency causes things to stop compiling and if there's some way of separating these dependencies?

Ashley Smith10:07:47

oh wow! Nice find!

Ashley Smith10:07:24

Specify jetty dependencies as the same version.. okay

Ashley Smith10:07:48

hmm I don't really know which deps to set the same version to, I only have one jetty dependency?


Or, bump up your figwheel to 0.2.3

Ashley Smith10:07:51

Front end is working

Ashley Smith10:07:55

lets check if the backend is

Ashley Smith10:07:42

It's working!! ❤️

Ashley Smith10:07:45

thank you!!!!!


Have you seen lein deps :tree?

Ashley Smith10:07:02

no I haven't. I'm not currently using lein either by the way 🙂


Ah whoops


:on-change #(swap! values assoc id (.. % -target -value)) i have a code but i don't udners this part do you know where can i find the related documentation of (.. % -target -value)


Could someone explain why re-frame is considered great? Seems to me like I'm writing a lot of boilerplate still

Ahmed Hassan13:07:46

Check Fulcro too.

Ahmed Hassan13:07:32

What kind of app are you working on?


Nothing in particular, just playing around with it. Thanks, I'll check out fulcro

Ahmed Hassan13:07:21

I've tried keechma, re-frame and fulcro.

Ahmed Hassan13:07:19

I liked Fulcro more than others.


What I like about re-frame: 1) It’s simple, 2) it’s explicit, 3) it’s functionally very pure, and 4) it separates concerns.


It’s simple: components don’t have to worry about digging through the app-db to find data; they just subscribe to the values they want. They don’t have to worry about updating a complex app-db, they just fire events. Subscriptions, done right, are often just looking up a value in a map.


It’s explicit: by which I mean, there’s not a lot of “magic” involved, like you get in things like Ruby on Rails. It may be a bit like boilerplate, but when you’re debugging, it helps to have everything laid out right in front of you, no mysterious “action at a distance” or behind-the-scenes black-box actions. (Yes, it does do some abstracting away of implementation details, but that’s fairly minimal, well-documented, and fairly easy to predict).


Functionally very pure: Side effects are restricted to event handlers and effects, and even then event handlers take in a state and return a state, so it’s still pretty functional and easy to test.


Separates concerns: It’s really nice that components don’t need to do complicated things in response to user interactions. Just dispatch an event reporting what the user did. The event handlers will take care of updating the app-db, or whatever else you need. And the event handlers don’t need to worry about layout or CSS styles or any of the things components do.


Also I love how you can make subscriptions that do form validation for you automatically, even complicated things like making sure the Total field equals the sum of the line item prices. No more worrying about “This field changed, now I have to trigger a validation on that other field, which depends on it.” Just take advantage of the built-in subscription functionality.

🍺 8
👏 8

@U06CM8C3V it's very detailed and structured reply. you may consider to publish it on medium or somewhere

😄 4
🚀 4

@m373h4n .. is a macro, (.. foo bar baz) is expanded to (.baz (.bar foo))


so that expression is equivalent to (.-value (.-target %))

🍺 4

ah thank you for the information


Next time you can expand it like this : (macroexpand '(.. % -target -value))

🍻 4

this is useful thanks i didn't know how to expand 🙂

👍 4

@shin From my personal point of view, re-frame is nice because it gives you structure.. it does not simplify your code, but it organizes it. By channeling all actions via dispatch and subscribe I think re-frame also tries to prevent you from doing something horribly wrong.. For example, you can access the db solely from your handlers and update it solely from events.. If you are absolutely impeccable, you could go without it and you would probably do very well.. but you still need to think of how you want the data to flow.. and that could take not a trivial amount of time.. go with re-frame and it's all already figured out for you...

👍 4

Personally (just my opinion) I'm not a fan. I like reagent. But re-frame is difficult to test. Has "global" state. And doesn't work with devcards.

☝️ 4
Ahmed Hassan13:07:03

@crispin Keechma is great alternative to re-frame.


Cool. Haven't heard of that. I will check it out.


I miss my devcards workflow with a reframe project 😞

🍷 4
Jeevaraj MV14:07:09

@here do have any spell check in clojure

Jeevaraj MV14:07:11

Since I’m from ruby background In Ruby we uses rubycop gem

Jeevaraj MV14:07:26

Pls let me know


@jeevarajmvsvg If you have any questions on how to use clj-kondo, just let me know in #clj-kondo

Jeevaraj MV15:07:24

Okay thank you

Jeevaraj MV15:07:32

Let me check