Fork me on GitHub
Siddarth Kumar07:03:47

When you’re new to clojure and you have a background in Javascript,PHP and Java, what is the best resource or path to start thinking in clojure? I would prefer video based resources thanks 😁


If you also are an interactive learner, you can try my Getting Started with Clojure guide which runs in the editor and lets you experiment directly using the REPL. I’ve put a few links to various videos in there as well, in the context I think they apply the most.

💪 3
Cora (she/her)03:03:57

Getting Clojure is amazing for adjusting to think about Clojure and how to use it


Here's another fantastic talk that's worth checking out:

Siddarth Kumar07:03:39

someone recommended this book : but I am more of a visual learner and I learn quicker with videos


@siddarthkay I love Tim Baldridge's video series. Clojure masterclasses:

👍 1

You may also like Eric Normand's

❤️ 1

Additionally, I would recommend material you can work with hands-on, like @U0ETXRFEW recommended;cid=C053AK3F9. The extremely fluid conversational development workflow a-la Lisps, Smalltalks, APLs is one of the hardest things to teach about these languages. You got to see someone do it, but then fool around on your own to wire it into your brain.


I will also plug the we teach at IN/Clojure. It is aimed at people from other programming backgrounds. Each "chapter" progressively builds on the previous ones, with in-line examples, and end-notes suggesting 4clojure exercises to reinforce the "chapter" concepts. The thing converges into a standalone app to process some planetary data :) It should take about a day to work through, and will get you from zero to hobby-level understanding.

👀 1

An important lesson is to observe a Clojure programmer using a REPL workflow. Here for example:


In JS/PHP you also have fast feedback loops with JS hot reloading and the way PHP is executed. But this is like a different more interactive level on top.


@siddarthkay there are many community resources at including video resources My humble YouTube channel has many videos, although not specific to any particular developer background

👀 1

I am building an application wit rabbit MQ from scratch , I am making use of for it, But I am confused how to build application using dependency injection using integrant , I never build a system like it ( dependency injection ) Can anyone give me reference please? or git link to refer - (May be I am asking architect question) But your help is appreciated 🙂

Ben Sless16:03:02

You can refer to this example with Component Or this one with Integrant TL;DR: anything with state -> turn into an argument -> state which is injected later


@UK0810AQ2, Thanks for your response - Will read it

Drew Verlee20:03:06

i would ask in #integrant also watch; and then;t=3430s the next day. Then realize what these solutions are offering a common abstraction around systems/processes that have actual physical lifecycles : they start, stop heal, recover, increase, scale up bc you need more, down bc you need less. The ideas are farther from math and closer to physics and so there more need to manage them. These solutions are, for example, more general then k8s which deals with a limited context. But generality isn't itself a goal, but as your solution requires more actors, having a common vocab across them is useful. If that doesn't make sense to anyone, let me know, i might be wrong, i don't get to play with these ideas much (for better or worse!)


Just consider a senior engineer is doing architecture work now 🙂


I’m trying to learn to better navigate complex datastructures using core functionality! Let’s say you wanted to reverse the two strings in this mess:

{:a [1 {:b [2 {:c "Hello,"}]} {:b [{:c "world!"}]}]}
so you’d end up with:
{:a [1 {:b [2 {:c ",olleH"}]} {:b [{:c "!dlrow"}]}]}
Does the core library have any neat tricks up its sleeve for this? I’ve ended up with a nasty update-map-update-map-update thing myself and can’t come up with something better. Examples in thread:thread:


Basic use of update and mapv:

(update data :a (fn [x]
                  (mapv (fn [y]
                          (if (map? y)
                            (update y :b (fn [z]
                                           (mapv (fn [x]
                                                   (if (map? x)
                                                     (update x :c str/reverse)
                                                     x)) z)))
                            y)) x)))
Using clojure.walk
(defn fif [pred fun] #(if (pred %) (fun %) %))
(clojure.walk/postwalk (fif #{"Hello," "world!"}
Using specter
(defn all-maps-in [k]
  (s/path k
          (s/filterer map?)

(s/transform [(all-maps-in :a)
              (all-maps-in :b)
              :c] str/reverse data)


I feel like it’d be possible to write small helper-functions to clean up the basic version :thinking_face:


I like the postwalk suggestion


(clojure.walk/postwalk #(if (string? %) (clojure.string/reverse %) %) x)

👍 2

(where x is your input sample - it'd reverse each string ending node - compared to the other solution by only referencing hello/world explicitly)


There is also update-in


Yeah, if we assume that the sequences are always vectors (I like to write my code assuming that’s not the case) then this isn’t too bad either!

(-> data
    (update-in [:a 1 :b 1 :c] str/reverse)
    (update-in [:a 2 :b 0 :c] str/reverse))
After sleeping on it I also think it cleaned up okay by introducing the home-made and not-at-all-niche function mup
(defn mup [xs k fun]
  (into (empty xs)
        (map (fif map? #(update % k fun)))

(update data :a mup :b #(mup % :c str/reverse))
I think I’ll stick to Specter or clojure.walk for these things in the future though 😅