Fork me on GitHub
Sam Ferrell04:12:42

I like the aesthetic of (comment " ... "), any reason I should use ;; instead?


You can also use #_ , which works as ;; for an entire expression. For example, these two are the same:

#_(def inc2
    (comp inc

;; (def inc2
;;   (comp inc
;;         inc))


Oh I just realized it was already mentioned below 🙂


(comment ...) evaluates to nil , which is not correct in some places within your code.

user=> (if (= 2 2) :true :false)
user=> (if (= 2 2) :true (comment "next line is false") :false)
Syntax error compiling if at (REPL:1:1).
Too many arguments to if

Sam Ferrell04:12:53

mmm thats a good reason


When should one use a promise-chan?


@samcferrell I only use (comment ,,,) for dev-only code that I want in files -- "Rich Comment Forms".


For actual comments, I use ;; for full line comments and ; for end-of-line comments.


If I want to "comment out" a form in my code, I use #_ which makes the form completely disappear (not evaluate to nil, which is what comment does).


@hindol.adhya No idea. Maybe ask in #core-async since that seems a bit esoteric for #beginners ?


@samcferrell I think the semi-colon comments are the only ones that are completely skipped by the reader - so if you have something like a :ns/ or other unreadable forms it will keep them from causing problems


Right, both (comment ,,,) and #_ expect a readable form/set of forms so what's inside comment and what follows #_ must be valid Clojure code.

💯 1

I'm trying to use this function from the twitter-api library but loading it

(ns mylib.twitter
    [twitter.api.restful :as twitter]))

(api/media-upload-chunked my-creds :params {:media image})
results in java.lang.RuntimeException: No such var: twitter/media-upload-chunked what am I missing here? isn't that function available externally?


Have you tried doing this at a REPL, and if so, do you get the same error messages?

user=> (require '[twitter.api.restful :as t])
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See  for further details.


@andy.fingerhut if you mean the SLF4J messages, yes I do get them


The name media-upload-chunked appears not to exist anywhere in the 1.8.0 JAR file released on Clojars


Probably the source code you are seeing on Github is more recent than the released version


According to this page about the package on, version 1.8.0 of that library was released in Feb 2017:


ah you are right! there is even an issue about it. So that means there is nothing in the code that prevents me from importing that function (if it existed in the clojars version)


You can also create your own JAR file locally on your dev machine from any version of the Github source code, if you wish.

👍 1

thanks! I'll look into that


I'm trying to use, which expects keywords corresponding to keys in the Firebase tree. So a foo key in the tree would be accessed with :foo, like:

  root [:foo]
  (fn [[event-type data]] (prn data)))
My issue is that the keys in my Firebase tree are sometimes prefixed with a colon, like :42. When I try to look those up using :42 in the code, it doesn't work, and using two colons doesn't work because then Clojure auto-resolves the keyword to the current namespace. How do I get around this?


@UPWHQK562 You can try to get around it via clojure.core/keyword:

((keyword ":42") {(keyword ":42") :ok})
;; => :ok


Hello guys, can you recommend some tutorial projects in GitHub to get practical experience in Clojure (and JVM in general) concurrency? I've read theory from various resources. I am with Erlang background (3 years of commercial experience) so it would be very interesting to compare concurrency aspects from practical side, not just theoretical. Thanks!


Any tip on a websocket library, both cljs and clj for a complete beginner to websockets, especially in clojure


There’s sente


@peder.august Server or client?


@hindol.adhya both, two separate libraries is ok


@dpsutton I tried it out, but couldn’t wrap my head around it


I couldn't wrap my head around sente either. Did you take a look at http-kit?


I did take look at it now, and it seems to introduce the concepts with a bit more simplicity. I’ll try it out. Already converted my server to use it.