Fork me on GitHub

what is the idiomatic way to iterate over HTMLCollection and NodeList in cljs? I'm surprised it doesn't work out of the box

deliciousowl06:08:24 or

(extend-type js/NodeList
  (-seq [array] (array-seq array 0)))


@admay Is Cursive so much better than its alternatives?


@sbauer I am sad to hear this. But I already had that feeling…


Thing is that Emacs and Vim have a rather steep learning curve. (Example: Yesterday I wanted to install the Clojure Layer to Spacemacs, and now the editor can not even start correctly anymore because of some error. I am sure it would take me hours to debug that. Calva for VS Code, on the other hand, worked out of the box.) So easier alternatives are good for starters with Clojure.


I wonder if Spacemacs is a bit more fragile? I've hardly had any issues with vanilla emacs, even after maintaining 3 or 4 configurations spread across a few computers over the years with varied package stacks, but Spacemacs seemed to break a lot right away when I tried it (not saying its like that, just that in my limited experience it was).

👍 8

As a beginner (1-2yo experience), i could say .. start with emacs not so good idea. I used many editors, VScode etc.. in the first half year with terminal/repl, after this switched to intellij/ cursive which i use now too. Since 2-3 months ago i can use emacs in good way, i know when is that emacs ‘bug’ (i did smthg wrong) or clojure code fail. So as you see, that is learning path. I did a mistake, i started with emacs.. that is killer for beginners

👍 8

I agree. I think this is a downside of that Clojure for the Brave and True book. It wants to sell you Clojure and Emacs in a bundle.


I think the fragility of Spacemacs is due to the fact that the packages are loaded from MELPA and not from MELPA stable. But right now the Clojure-Layer from Spacemacs seems not to get well along with the latest Cider version. I think Spacemacs has a solution for this problem in their upcoming version (0.300), where they introduce some sort of stable repo for the packages. Hence, until the release of Spacemacs 0.300 I’d consider Clojure to be broken for Spacemacs (unless you use Spacemacs’ devel-branch, or you manually pin the cider packages to MELPA-stable).


This is correct from my understanding. They need to fix this fast, because for beginners this makes Spacemacs nearly unusable without hours of hacking around in its config. I want it to work so much, but everytime I try I am back to VSCode after 30 minutes.


If I want to make a one page clojurescript app that runs entirely in the browser, what should I use? reagent?


Other persons here pointed me out to Re-Frame, which is based on Reagent.


However, I have not really tried it. But it looks good from far away.


@coinedtalk There are a few alternatives, but my personal favorite for that purpose is reagent (take a look at re-frame too after you've learned the ropes in reagent, it brings some very nice structure to the application)


Hi Clojurians, I’m having hard time updating record via HugSQL. SQL:

-- :name update-person! :! :n
-- :doc updates an existing person record
UPDATE persons
SET first_name = :first_name, last_name = :last_name
WHERE id = :id
Code: (db/update-person! {:id 15 :first_name "F" :last_name "L"}) Error: ExceptionInfo Parameter Mismatch: :first_name parameter data not found. :face_with_monocle: The fact is it does actually retrieve the data with that very ID if I call get-data function.


Looks right, maybe a stale compile hanging around somewhere?


No idea, has already restarted REPL a few times…


try quit REPL/ lein clean/ restart REPL?


Also double check for dash-vs-underscore typo, it’s real easy to do and to miss


Well, here’s a catch: I have a configuration in the same namespace: db. and somehow REPL doesn’t seem to resolve configuration def when I evaluate it, although eval is successful.


Hmm, I dunno then, it’s weird


There’s a #hugsql channel, seems fairly inactive, but you might want to try it


I’ve solved it, name duplication was the problem. Thank you!


Are those books any good? Is there another good introduction other then Clojure for the Brave and True?


@tobias.vetter Joy of Clojure is my very favorite Clojure book, but it's somewhat dense; possibly better as a second book (although if you've done Brave &amp; True already, you may well be ready for it). Programming Clojure is also good, and should work well as a first book.

👍 4

@tobias.vetter Absolutely. Joy of Clojure was a joy to read. The pace is a bit high though. It's a whirlwind tour of the ideas behind Clojure more than the details (although there are quite a few useful tidbits). If you've watched all of Rich's and Stu's talks, then you'll feel right at home. Programming Clojure is closer to a cookbook than Joy of Clojure and has more details.

👍 4

Stuart Halloway. Many members of Cognitect in fact, have given great talks about Clojure and software engineering. Stuart Sierra, Timothy Baldridge, Michael Nygard, David Nolen, Alex Miller and Fogus are the ones off the top of my head. Stuart's Narcissistic Design is especially funny.

👍 4

Was a quite interesting watch.


Note: I'm a beginner myself. Haven't used Clojure in a professional setting (, yet).


I like codinggame


I think this is web based?


lets you learn clojure at your own pace with minigames


like help batman defuse the bomb etc

Alex Miller (Clojure team)13:08:30

Programming Clojure is amazing

👍 12
Alex Miller (Clojure team)13:08:43

you should buy copies for all your friends

Alex Miller (Clojure team)13:08:29

for intro books, I think the best options right now are Brave Clojure, Getting Clojure, Living Clojure, or Programming Clojure

👍 8

Pragmatic Bookshelf describes Getting Clojure as an expert book:

Alex Miller (Clojure team)14:08:35

My personal opinion having read it is that that is a misclassification

Alex Miller (Clojure team)14:08:29

I’d check out the book excerpts and see what you think

👍 4
Eric Ervin21:08:21

I finished Getting Clojure a few days ago. I think the author does a great job of splitting the text into Basics/Intermediate/Advanced topics.

👍 4

Looks good. I actually have read another book (Eloquent Ruby) by the author.

Alex Miller (Clojure team)13:08:58

they all have different approaches and so if you try one and don’t like it, try another one!


Programming Clojure is my fav'

👍 4

Good morning


I did this macro, but it keeps giving me warning, any tips??

(defmacro execute [pool func & body]
  `(.execute ^ExecutorService ~pool
             (fn [] (~func ~@body))))
Reflection warning, catalog/services/es.clj:60:22 - call to method execute can't be resolved (target class is unknown).

Mario C.14:08:08

@tobias.vetter I don't know if you have made up your mind but I also thought Spacemacs would have a deep learning curve after I first tried it and got stuck inside a buffer. But in all honesty if you stick to it for a week and give it an honest shot you will pick it up well enough to be able to work with it. I am also a beginner and have been using it for a little over a month. I can move around and do editing.


I want to like it, but stuff always breaks on my with Spacemacs. I am not trapped in some window or menu, but it breaks when it wants to install dependencies.


You could configure it to not auto update


So you can stay on a stable build

☝️ 4

@tobias.vetter are you seeing breakage related to CIDER, or other stuff? CIDER breakage is due to an unfortunate disagreement between the author of CIDER and the author of SM about whether it's reasonable to treat snapshot builds as deployable code. CIDER has had a ton of churn lately (working on improvements!) some of which has broken stuff for users; SM unfortunately goes with the latest-n-greatest build. Hopefully not a long-term problem (and SM is adding the option of defaulting to only using stable builds), but as dadair points out, you may want to stick with a stable build for now.


It broke after I agreed to install the Clojure layer after I first opened a Clojure file.


Oh, interesting. Fair enough, just wanted to toss out a warning signpost for the SM update issue I'm aware of. BTW I'd expect you could solve that problem by deleting your .emacs.d directory and re-cloning it from Spacemacs. Wouldn't hurt to delete your .spacemacs too to ensure nothing there is broken, but probably only worth it if you haven't modified it much yet (and of course you would need to re-add the clojure layer to dotspacemacs-configuration-layers).


Or actually it sounds like you didn't explicitly add that layer -- so that would be a good thing to do.


I can understand just giving it up as a bad job for now, though 😉


I just did that. Now it breaks on another step.


This happened after I did this:

Mario C.17:08:32

What instructions are you following to install spacemacs?


git clone ~/.emacs.d


Well, that one does look CIDER-related, so you may be tripping over the thing I mentioned. This may be a bit of a process, I’m afraid. What I’ve done to keep things stable is add the following at the beginning of my dotspacemacs/init (in .spacemacs). It may or may not work for you. You should be able to get a definitive solution by posting the error in #cider — hopefully someone can walk you through whatever the current fix is.

(add-to-list 'configuration-layer-elpa-archives '("melpa-stable" . ""))
  (add-to-list 'package-pinned-packages '(cider   . "melpa-stable") t)
  (add-to-list 'package-pinned-packages '(clojure . "melpa-stable") t)


Thanks for the help. But I think I will stick to VSCode for a while and then will look if Spacemacs and its dependencies work.


Can't blame ya 🙂

👍 4

if you do decide to give spacemacs another try you might want to use the develop branch. it was explained to me that in some ways it can be more stable than the stable branch because it's seeing a lot more active bug fixes I think. I'm usually a stable version of everything kind of dude but I made the switch and it's not only been smooth running, it also starts up much quicker for me. To try it out, after you clone the github repository as you did, you would just do:

cd emacs.d
git checkout develop
then when you start spacemacs you will be in the develop branch and can install the clojure layer. Sounds like a lot but it worked great for me and I'm loving it.


I will try... But isn’t the develop more unstable?


Yeah, things break more often, but then they git fixed faster 😜


I’d say consider giving it a shot, and if it’s working well, freeze it for a while and don’t worry about updating until you’re ready to turn your attention back to tweaking your dev environment.

Alex Miller (Clojure team)15:08:10

probably good too, I haven’t looked at it since the 1st edition. The second ed targets Clojure 1.6 (currently stable is 1.9).

Mario C.15:08:59

Lmao whats with the book covers for Clojure? :rolling_on_the_floor_laughing:


not Clojure, all the books from that publisher look like that 🙂

👍 12
Mario C.15:08:22

If anyone is curious


As I recall, both editions of Clojure in Action were rushed to print: a new version of Clojure appeared before each edition was published but the editors refused to allow another pass over the book to ensure it was brought up to date. Much as I like a lot of the Manning books, their editorial process leaves a lot to be desired, IMO.

👍 4
Alex Miller (Clojure team)15:08:33

That is a particularly bad Manning cover :)


Oh, I dunno, I kinda like it 🙂

Alex Miller (Clojure team)15:08:12

Book authors typically have little influence over the cover btw


Hello, are there any clojure workshops with more in depth material ? this one was a joy to go through but only covers topics up to concurrency

Alex Miller (Clojure team)17:08:40

that material is based on the intro workshops we do before the Clojure conferences (like the upcoming Clojure/conj). in case you’re interested

Denis G17:08:23

Can I have 2 projects inside of a projects.clj? For example for client and server apps? Define twice (defproject ...) ?


@denis.fuenzalida for client and server, you would usually use profiles


e.g. you’d have a :client profile with client dependencies and commands, and a :server profile for server dependencies and commands

Denis G17:08:22

@lilactown thanks Will. Another fast question regarding websockets. For this the best framework to use is aleph, right? Any other alternatives? What would you recommend


@denisgrebennicov there’s Sente and Pedestal as well


sente is a wrapper on the communication layer, it works with aleph or pedestal


http-kit too, I think


TooTallNate's websocket server is pretty easy to wrap too

Denis G18:08:01

Thank you guys!

Denis G18:08:22

Aren't agents like actors but with a function being passed to the actor in order to process the message? I mean of course agents do not have supervision and stuff, but it could have been implemented, right? Link to stackoverflow question:


the message is the function so it's inverted - you don't send data to a function and get data back, you send a function to some data and it updates itself


IIUC, the traditional "actor model" is a non shared memory situation


So agents can bang on the same state. But actually you usually use them in more of an actor like way


how do you folks deal with so many options to explore? It sometimes feels a bit like the JS world with 3-5 different popular choices at each lib decision

✔️ 4

I generally grab one that looks ok, try it out, and if it works for my problem I keep it. I also don’t generally use too many libraries (especially compared to front-end JS projects).


@risinglight You can always ask for advice on library choices -- but don't be surprised if there are two or three that seem equally popular and also well-maintained. Clojure is opinionated about some things (at a core abstraction level, mostly) but not about others -- and libraries proliferate because of that.


But also, in Clojure, libraries all tend to follow those core, idiomatic abstractions too so any choice tends to be "good".

👍 4

That’s good to know. It just feels overwhelming after awhile 🙂


It feels less and less overwhelming over time as you get used to the ecosystem -- if that's any consolation? 🙂


it is also an evolving space, jetty supports websockets these days too (I am not sure if are any clojure libraries around that, or any attempts to unify that with ring anywhere)


so what was true when a lot of clojure libraries and abstractions got their start (ring, aleph) isn't true now


This can be quite a helpful site for library choices, or at least to look at the landscape (but, yes, also a bit overwhelming).


@hiredman What are we using for websockets these days? Several years ago Fumiko and I built a p.o.c. based on Sente and Netty, as I recall...


we are using which provides all of http and websockets, and on top of http and websockets


You're not using much of an abstraction layer over that, right?


(a lot of core.async but otherwise... just raw interop? you can tell I haven't dug into that part of our codebase yet!)


no, I guess, we aren't using a lot of stuff, mostly just as a transport layer for messages


we do have a ring adapter so we can write regular ring handlers on top of the webserver provided there, but it isn't used very much


Has anyone done development on cljs from "within" a flask (or any other web framework)? For example, I have a python flask server, and I want to have it serve my cljs from /app. This is easy enough once I build the final JS/CSS/etc assets, but during development, how would I go about that? I have a flask dev server running and serving my HTML templates, but I can't also have live reloading? Should I just do my dev with the cljs live reloader, and expect to build/serve it from the flask app later?


figwheel can make reloading work via a web socket, while your app talks to your real server


@hoopes I just figured this out myself w/ figwheel-main and the Django dev server the other day w/ the help of bhauman in #figwheel-main. Long story short, you can use :output-to and :output-dir to get the js files into a dir that is served by Django dev server, in my case /static. The dev JS in turn connects to the figwheel dev server for hot reloading


(I think this does require figwheel and your server being on the same host, but I'd assume that's easy to ensure during dev)


no kidding


yeah, what @risinglight said in more detail :D


yeah, the thing that makes it just work is that figwheel just wants a socket connection, it doesn't need to be the http server serving the js itself


awesome, i'll give it a shot - the funny thing about this slack is i have like a directory full of chat snippets from super-helpful things i don't want to lose to slack limits 🙂


@noisesmith the same host isn’t required


oh - I thought it would run into cross host validation issues


it already does if you have a different port


oh, good to know


the browser allows you to talk to a local websocket regardless of crosshost issues


implemented some super hairy stuff that that communicated to a locally running auth process that way once


hyeah, there's a lot of un-exploited opportunity down that avenue


what jvm version does clojure 1.9 require?


I wanted to build a javafx integration for alpine Linux but theyre stuck at java 8


@m131 Clojure 1.9 will run on Java 6 onward. Clojure 1.10 will require Java 8 onward.


thank you! it's been a long time since I've compiled a jar to distribute- i found my java 10 compilation failed to run on java 8, but is it backward compatible? if I make a lein uberjar on a java 6 runtime can any user with java 6 onward run the jar?


I don't use AOT and haven't had a Java 6 environment around for years so I can't say with any certainty, sorry.


ok thanks, i guess at the least, if I get it working in alpine that's a good starting point


I would expect that a compiled uberjar, built on Java 6 would run on Java 6, 7, and 8, because I would expect that level of backward compatibility from the JVM...

☝️ 4