Fork me on GitHub
Ivan Koz03:07:52

Can somebody explain me the meaning of "direct and transitive calls" in core.async/>!!

Alex Miller (Clojure team)03:07:07

direct = you invoke a function transitive = functions that you invoke, invoke a function

Alex Miller (Clojure team)03:07:41

so in context, that means inside a go block you should not call >!! or a function that calls >!!

Alex Miller (Clojure team)03:07:11

if you do, it can block, and there are a small finite set of go block threads - if you block enough of them, go blocks stop working

Ivan Koz04:07:08

thank you Alex, very helpful

Gagan Gayari10:07:50

How can I run the core.logic constraints on an external database( Neo4j etc) using pldb ? Kind of querying. The database is huge and I don't want to pull the whole DB.


Have a question about ex. 3 from here From the ex. 4 it seems like it is somehow possible to calculate those futures in parallel using reduce (in contrast to using atom). But I can't understand how we can do it. Something like this obviously does not work:

(def v [(future (sum 0 (/ 1e8 2))) (future (sum (/ 1e8 2) 1e8))])
(reduce + v)
Can somebody please point me in the right direction?


Futures return a value eventually. You need to deref it to get its value


Oh, now I got it. I was doing something like (+ @(future …) @(future …)) and wondering why it seemed like a consecutive execution with no improvement in time. Now I understand that I need to start futures simultaneously, e.g. [(future …) (future …)], and when I refer to them later they will already be executing in parallel. Thanks for clarification!

👍 1

According to Programming Clojure, 2nd Edition, What if you want to coordinate an update of both current-track and current-composer with an atom? The short answer is “You can’t.” That is the difference between refs and atoms. If you need coordinated access, use a ref. But this seems to work with any problem, what am I missing from that explanation?

(def current-track (atom "Venus, the Bringer of Peace") )
; #'user/current-track
(def current-composer (atom "Creedence Clearwater Revival") )
; #'user/current-composer
 (reset! current-track "Ramble tamble") (reset! current-composer "CCR"))
; "CCR"
; "CCR"
; "Ramble tamble"

Alex Miller (Clojure team)14:07:26

The reset! and @ there are not part of the transaction

Alex Miller (Clojure team)14:07:37

that is, the dosync is doing nothing there

Alex Miller (Clojure team)14:07:31

and a concurrent modification in a different thread could change things in between the reset! and @


That last message is what explains it best for me Thanks for the fast answer!!

Alex Miller (Clojure team)14:07:16

np... you should check out the 3rd edition of that book ;)


I actually have a physical copy of the 3rd edition 😊 and a digital of the 2nd, I’ll be sure to check this part specifically. Maybe it also explains why is it ok (transaction-wise) to group several ref-set inside a dosync, but it’s not nice to run several reset!


I'm going through brave clojure and the points me towards which reads

WARNING this does not work currently.
A lot has changed since I last put significant effort into this repo, and as a result this emacs config is broken. 
I hope to get it working again soon (as of 2022-04-02)
I was wondering if anybody has a safe/up-to-date reference for setting up emacs for clojure.


I think is well-maintained and there's a #prelude channel (as well as an #emacs channel).

‼️ 1

I can't recommend any setup guides as it's been many years since I used Emacs but back when I did use it, Prelude was what I settled on after many other attempts to get a good dev env up and running on Emacs 🙂


(I switched to Atom and then VS Code, in case you're wondering, mostly for their ability to render arbitrary HTML UIs and therefore support visualization tooling)


In general, for beginners coming to Clojure, I recommend using whatever editor/IDE you're already comfortable with if it supports Clojure.


According to Emacs usage has decreased from 50% four years ago to about 40% now, IntelliJ/Cursive has held steady at 30% and VS Code has climbed from 10% to around 20%.


100% agree on both counts. Prelude emacs is actually written by the author/maintainer of CIDER. A great way to go. But there is no need to learn Emacs just for Clojure. If it sounds great (I love it) go for it but Cursive has a free community version for IntelliJ and VS Code has Calva which is free and open source.


I had no idea there were so many channels! Should I have asked this in the #emacs?


we’re happy to help beginners get setup. We might direct you to other channels to get more specific help but “I’m a beginner and I have a question” is perfect for #beginners


(ie, don’t read “ask in #emacs ” as saying you shouldn’t have asked here. just that they can help more)


If emacs isn't a good idea these days, by no means will I force using it, but I've been using it here and there for almost a year and brave clojure had me thinking it would be a very nice experience to pair it with clojure. I also have VS Code with Calva (which works just fine honestly) and Cursive (my first impression wasn't too great but I'm willing to blame myself). I'll ask my original question in #emacs and then get something set up to get a little taste.


roll with emacs then


Or wait.. I almost forgot about prelude. 😆 I guess I don't need to ask.


just install cider m-x package-install [enter] cider and you are good to go


@U11BV7MTK Might you know what "The lein executable isn't on your 'exec path'" means? I have cider installed and it returns that message whenever I cider-jack-in.


sure. so just like your command line has a list of places to look for executables (the PATH variable) so does emacs. Usually the easiest way to fix this is which attempts to copy your system’s path into emacs exec-path

❤️ 1

and there’s a #cider channel and of course #emacs for all of your questions you might have about that


(and of course this assumes you have actually installed lein if you intend to use it)


I don't know enough to know what alternative to lein there is and what benefits it has, but I do have lein installed 🙂 and it is working now!