Fork me on GitHub

Is the recommended way to go for basic reading/writing of xml? are there any community libraries that I should look at? I had a look around but didn't spot anything, thought I would ask here before embarking down the data.xml path


for basic read/write I'd use, there are also bindings to xpath / tagsoup and there's a zipper implementation for xml in


the zipper being for cases where you have to do complex alterations or extractions

Dave Compton00:05:15

@hiredman Thank you. Putting the -w option before the -c option got source file monitoring to work as I had expected. Sorry for the slow response - took me a few minutes to test.


@noisesmith thanks, I'll take a look at those. i had seen the referenced.


zippers are cool, they are a whole sub-language for manipulating complex data structures


definitely not what you need most of the time, but pretty great when you need them


Yeah I was just learning about them last week. Definitely something I'm glad to have in the tool belt

Alex Miller (Clojure team)00:05:00

and use the latest version, even though it's alpha or beta or whatever


I succeeded in running "hello world" in clojure. I used vs code and also I tried Emacs. I'm using vs code very well in JavaScript development. My question is it worth to learn Emacs in 2019 , are still recommendation from "Clojure for the Brave and True" book relevant ?


like learning vim bindings, it's probably only worth it for a long term investment, using with multiple languages. I wouldn't learn it just to write Clojure. That said, it's not particularly hard to get up and running with Emacs. Maybe someone else who uses VS Code for Clojure can chime in and say if it's missing any features.

👍 4

Hello Yadia - as someone who is also new to Clojure / ClojureScript … I would recommend that you watch this video:


Its going to be mentally consuming enough — learning Clojure … so I would not try learning a bunch of tools on top of that. --- You can always learn those later.

👍 8
💯 4

@lucascoffey Thanks. It's good point


@michael.e.loughlin Sorry , I didn't get your second point. As I understand you are not agree to learn Emacs just for Clojure.


I think Vim & Emacs are very valuable tools to learn


however I come from the world of Python / PyCharm - so using Intellij Idea w/ Cursive is wonderful


So if VS Code has something similar that you are used to, then by all means use it.


@jyad1866 It's a judgement call. It's good to learn Emacs if you want to use that, but you will be learning and thinking a lot about Emacs and not Clojure, as @lucascoffey said


I personally don't think it's worth learning Emacs just for Clojure


I think knowing vim or Emacs and being productive in those editor is different. I'm using vim occasionally but I don't use it for writing a serious project. because I can't remember all that key bindings. It take times but it's not worth for web development at least for me.


if you don't want to learn lots of keybinds, then I don't recommend emacs!

Jamie Rumbelow12:05:18

I’m working in Clojure with VS Code, which was also my editor of choice before I starting using the language. The setup can be a little fiddly, but the clojure, cljfmt and parinfer extensions are excellent and it doesn’t seem to miss much from emacs / cursive / alternatives

Jamie Rumbelow12:05:28

I even get intellisense suggestions and docstrings


@michael.e.loughlin I know some of keybinding in Vim also in Emacs today I learned some and I can learn it. but as you said I see it took months for me to be enough productive.


also thanks for your good points


@jamie962 thanks for the points. how do you get intellisense, do you special extention?

Jamie Rumbelow12:05:30

The ‘clojure’ extension, when connected to an nREPL should do it 🙂


I used Calva

Jamie Rumbelow12:05:01

You’ll need to boot a repl up in the terminal with lein repl, then connect it with the command


I used Calva do you use this, or other extention

Jamie Rumbelow12:05:56

I’ve used both Calva and Clojure

Jamie Rumbelow12:05:09

I’m not sure which I prefer. They appear to be the same. and they both work well.

👍 4

I'm trying to introduce some beginners to programming via Clojure, given no prior experience with with either would VS Code + Calva or Atom + ProtoREPL a better choice?


Also is it a good idea to start things out with Parinfer? The Atom plugin for that looks a lot better developed


IIUC, the Parinfer author has focused development on Atom for now, but I believe it will continue to support other editors, and I'd except any advances made in Atom to be adapted to other implementations.


( hope this is the right place to be asking these questions)


Sure, this is a good place for questions like that


I think personally I would go with Atom and parinfer


for an even easier introduction try:

💙 8

no installation / plugins required!


Yup! I've been starting them off with Maria which is absolutely awesome for this sort of thing


but after a while they need some external dependencies (for some domain-specific application), which can't be done in Maria

Ian Fernandez18:05:15

there's a way to do this?

Ian Fernandez18:05:37

(-> arg (update :attributes decodejson
                    :created-by str
                    :invited-user-id str
                    :channel-id str))

Ian Fernandez18:05:12

"multiarity update"


you'd need to do multiple update calls


since update supports passing arbitrary extra args to the transformation function, it's kinda locked down to doing just one at a time


you can use reduce-kv plus a function using a map from key to updating function if this is a performance concern


(def updaters {:attributes decodejson :created-by str ... ...}) (persistent! (reduce-kv (fn [m k v] (assoc! m k ((updaters k identity) v)) (transient {}) original-map))

Lucas Barbosa18:05:19

Guys, I just wanted to share with you that got an offer to my first full-time Clojure job! You are all definitely part of this, since you helped me multiple times during my initial learning process. Thanks a lot!

🍾 40
👏 20

Hooray! Congratulations, Lucas! 🎉

❤️ 4
Alex Miller (Clojure team)18:05:51

Keep hanging out and pay it forward to the next one!

❤️ 12
Eric Ervin20:05:24

Would be ace if you typed a short description of your learning process into the main beginner thread. A bulleted list even.

Lucas Barbosa18:05:49

@U9U0G3Q8Y where is that thread?

Eric Ervin18:05:55

Sorry, I mean channel. Hopefully you'll say something out in the main #beginners channel.


@noisesmith into might be better in this case for performance, no? Especially if there are a lot of keys in the map not being updated. Something like:

(into original-map (map (fn [[k f]] [k (f (get original-map k))])) updaters)


@michael.gaare that's a good call yeah

Alex Miller (Clojure team)18:05:14

if you're updating just 4 attributes, it likely doesn't matter. why not just assoc them all in one go?

Alex Miller (Clojure team)18:05:31

(assoc arg :attributes decodejson
                    :created-by str
                    :invited-user-id str
                    :channel-id str)


don't think that's gonna do what what OP was asking for - decodejson and str are meant to be applied to the values in arg

Alex Miller (Clojure team)19:05:03

(let [{:keys [attributes created-by invited-user-id channel-id]} arg]
  (assoc arg :attributes (decode-json attributes)
              :created-by (str created-by)
              :invited-user-id (str invited-user-by)
              :channel-id (str channel-id)))


that should do it. we'll get this shed painted yet 😉

Alex Miller (Clojure team)19:05:04

for me, it's real obvious what that code is doing. I'm sure there's a faster way, but I'll take obvious over fast as a first pass

Alex Miller (Clojure team)19:05:05

but you could easily write an update-many macro/function that did the fast thing and was probably easier to read than reduce-kv or into would be directly


just chained updates would probably be pretty good, not requiring the triple-redundancy of mentioning the key names. I have a personal thing where if I have a chance to use into with transducing arity I will do it 10/10 times


the new supdate library is kind of neat for doing multiple updates to structured data:

(require '[vvvvalvalval.supdate.api :as sup])
(sup/supdate data {:attributes decode-json
                   :created-by str
                   :invited-user-id str
                   :channel-id str})


FWIW, I'd recommend writing your own function over reaching for libraries. Especially when starting out

Eric Ervin21:05:50

I saw this recently in someone's code. Part of an animation of falling rain.

(-> drop
         (update :y + speed)
         (update :speed + accel))


I've since switched to some specter libs since they offer a lot easier updating of mixed types in data structures (arrays nexted in object nested in arrays etc

Eric Ervin18:05:05

Ya. I skipped the experiment where you used specter. I've seen Mr Marz demo Specter and it's amazing, but I'm just resistant to learning new libraries, though clojure2d might be in the queue.


It does have an understanding curve, but when I came back to it after a while it clicked into place. I've found actually having the pressing need to solve something helps understand the tool better

Eric Ervin20:05:19

You drawing ideas, as in 04_projection.clj, are a bit more involved than anything I imagineer. Most of the time I'm imagining what I'd do with an xacto knife and a glue stick.


yeah, that one is basically me trying to project 3d points onto 2d. Something I wrote down to work out before coding. I doubt it's 100% correct, it's only working off of a vanishing point. I want to try some shading and simple 3d models with that one but never got back to it

Eric Ervin00:05:56

Ah yes. Getting back to it. I'm just now resuming my study of 10_photo_manip.clj . As far as I know, quil doesn't have anything as slick as clojure2d's filter-channel , so I'm doping out the filtering myself. Just posted an aside in #quil


Glad my experiments are useful. They're mostly just my testbed when I think of random things, so completeness isn't always the goal

Eric Ervin03:05:28

Ya. (Re)learned about clojure2d, destructuring, and threading. In June I'll probably need to work on something sad and practical like Python


Hi, I'm trying to create cljs and tools.cli to create an svg viewer. I'd like to be able to set paper sizes from the cli e.g clj -m cljs.main -m svg.core --format a3 but can't figure how to call my namespace properly


svg.core uses parse-opts and Ive created a list of possible cli options, taking my cue from the example under tools.cli GitHub page


hey bones. I don't believe this will work; a couple reasons: 1. you can't have two "mains" (in Clojure / JVM speak) right now, so your two -m commands won't work 2. your CLJS code, svg.core, will be executed in the browser, and there's no way pass these command line options to your browser code


hi ppl, I am writing an application and I would like to test my functions that interact with the database. I'm using toucan to manage the mysql database. However, I noticed that I have many functions with the following pattern

(defn feature2 [args]
   (db/insert model/Table args))

(defn feature1 [params]
    (feature2 ... ))

The problem I'm facing with this nested-pattern is way worse than this example. If I want to test the feature1 function, I'm not able to use the test niceties of toucan which creates a mockup object of my table because feature1 can't inject the mockup object into feature2. Am I thinking right? What is a good pattern for this problem? Thanks


if possible the cleanest way to fix things like this is to avoid hiding IO inside abstractions


pure functions can nest seamlessly inside IO functions, the reverse often causes problems


so put the IO stuff at the top level, and then inside the IO doing function, call the pure functions (when possible)


you can also use dynamic bindings, or a "context data" map that gets passed recursively down through the layers of code


but often the pervasive usage of "context data" is a sign of poor organization, or even your entire stack being "upside down"


yes, I am leaning to your last option here. I think things are not right.


do you have any material with recommendations to app organization?


I'm still at the very beginning of this solution, for now a good refactor would do good


Zach Tellman's book "Elements of Clojure" is excellent

💯 12

I am actually in the process of reading it right now and could not agree more. — Even though its kind of dense / deep at times I highly recommend it to newbies like me because when you are first starting out there is nothing more helpful than having someone to say: -- “Here is how you do it”


— At this point I don’t know enough to form my own judgements about — “Theories on best software practices.” --- So I just need someone to hold my hand for now until I “learn to walk on my own.”


and there are state management libraries that work well with the pattern of putting side effecting / config dependent things at the top of your abstraction stack (stuartsierra/component, integrant, mount)