Fork me on GitHub

I don't understand the difference between blocking put and normal put / take


blocking put holds up the thread until it is done put ting?


more or less, yea. on the other hand, parking put, >! ,is for inside of go blocks which will run in a thread pool. since there a limited number of threads, if you block them, then you can prevent other go blocks from running. you don't want to call blocking put, >!! ,inside of a go block


Ah okay thanks that's a little more clear


Hey guys, I have trouble starting my project with cider-jack-in

[nREPL] Starting server via /home/linuxbrew/.linuxbrew/bin/clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.8.3"} refactor-nrepl {:mvn/version "3.0.0alpha13"} cider/cider-nrepl {:mvn/version "0.25.9"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]"]}}}' -M:cider/nrepl
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: DEPRECATED: Libs must be qualified, change refactor-nrepl => refactor-nrepl/refactor-nrepl 
after following this step refactor-nrepl => refactor-nrepl/refactor-nrepl
Error building classpath. Could not find artifact refactor-nrepl:refactor-nrepl:jar:3.0.0alpha13 in central ()
Any help is greatly appreciated


the version should probably be "3.0.0" rather than "3.0.0alpha13". there is a "3.0.0-alpha13", but "3.0.0" is the latest,


yep that worked


I never knew people used linuxbrew…


Is there a free way to learn how to make a site with react in clojure ?

Stuart11:11:33 there is this series. Clojure script for react Devs.


could work only I do not know react


AS far as I've seen, people don't generally use react directly and instead opt for reagent.


But frontend stuff is definitely not my specialty, I've only ever needed to use the basics of that reagent page to make anything I've wanted.


also not mine. I see that more and more loves back-end stuff. Also tried to learn clojurescript but have not enough xp and knowlegde to make a nice layout


Reagent is probably a good way to get started. If you have little experience in frontend stuff, just start by realising you are your first user. What do you need, what do you want to accomplish and what is the easiest way to do so. You only need a pencil and a piece of paper to solve that. Once you have figured out what it is you need, start by creating the simplest components and slowly build up the UI. I would recommend taking a look at storybook and its philosophy if interested. It may be a bit much, but its component driven methodology is certainly a good way to reduce complexity and build better code/components.


Oke, if I look at the next challenge the components are there but no css or whatever


I think you will ahve to learn html / css seperately. I can't imagine anyone writing a tutorial for clojurescript / reagent / re-frame etc is going to be include learning css


This one not


and it also not given any css to let it see as given in the first image


there is a reference to bulma's styles at the bottom of the page. I assume that is what it uses for styling


oke, then I can better clone the code then type with the tutorial


and then change things to make a telephone number. Which schould havea type what I think could be personal or a company telephone number

Daniel Craig18:11:25

Jacek Schae has a tutorial but I'm not sure if it's free


but is a small part of a bigger course which costs some 200 euro and that is a lot of money for a hobby developer


pity that all good courses are paid.

George Silva15:11:08

Friends, I have a question: I want to define a multimethod, that based on a type of file (a map), it will download a file from certain place, using a certain protocol (ftp/https). This is what I have for now:

(defn dispatch-download [file datetime output-file]
  (:protocol file))

(defmulti download! dispatch-download)

(defmethod download! :https [file datetime output-file]
  (println "https"))

(defmethod download! :ftp [file datetime output-file]
  (println "ftp"))
See that the download! function takes three parameters? Is there way to shorthand the dispatch-download file, to use the shorthand :protocol function from the first argument? Basically I want my dispatch fn to have only a single argument. (defmulti download! :protocol) But I still want/need it to have three arguments.


Is this close enough to what you want?

(defmulti download! (fn [file _ _] (:protocol file)))

George Silva16:11:31

let me give it a try...

George Silva16:11:42

What would you say is most idiomatic? The dispatch function is super easy and unlikely to change, meaning I don't think I need to test it


Or to make even fewer assumptions about the number of arguments:

(defmulti download! (fn [file & _] (:protocol file)))

👍 1

I often find myself using a dispatch function that has as few assumptions about the arguments as possible. In this case, you only care about the first argument to the function, so I would say the most idiomatic approach is to use a dispatch function that ignores all other arguments (regardless of how many of them there are).


To your original question, I don’t know of a way to pass a different (sub)set of arguments to the dispatch function.

George Silva18:11:29

No worries. I think your proposal here makes sense. Hiding the other arguments with & is a clever way of making the dispatch function not care.


Happy to help!


Hi, I'm just trying to get the size of a file and wanted to use java.nio.file.Paths for that. I tried to call the static method using Java interop like this

(java.nio.file.Paths/get "filename")
which results in
(err) Execution error (ClassCastException)
(err) class java.lang.String cannot be cast to class (java.lang.String and are in module java.base of loader 'bootstrap')
Looking at the documentation of the method I noticed that the method is overloaded: public static Path get(String first, String... more) public static Path get(URI uri) So I thought I could use a type hint to allow the compiler to resolve the correct method like so:
(defn with-typehint [^java.lang.String s]
  (java.nio.file.Paths/get s))

(with-typehint "filename")
But it still throws the same ClassCastException. Could someone tell me how I can force the correct overload of the method to be called?

dpsutton20:11:02 . It’s a bit of confusion because there’s java sugar for var args that Clojure does not have. That signature is actually public static Path get (string first, string[] more), just javac will provide the sugar for you and pass an empty array here


(java.nio.file.Paths/get "filename" (into-array String []))


Ahh thx a lot I didn't know about the vararg conversion yet!