Fork me on GitHub

@takamura.developer I think it's fair to say that Om.Next is very opinionated compared to Reagent. Some people like an opinionated framework, some don't.


Cool! I will try more reagent tutorials then, thanks!


I did a project in and I confess it never gelled for me. I repeatedly had the experience of reading the documentation, having a false moment of realization, then sitting down to code and realizing I had no idea how to go about what I wanted to do.


What about tools? the usual tools for cljs development are: lein ou boots? figwheel or cljs-shadow?


@takamura.developer I can't give you much guidance on cljs tooling -- it's evolved a lot since I last tried to use it all (it was pretty bad three years ago! 🙂 ).


@takamura.developer You may wanna check out qlkit. It is a much simpler implementation of the concepts behind Om Next. About 300 lines of code. You can read the source to understand the concepts and then go about using Om Next.

👍 4

ooh I'd not heard about qlkit


Where can I clear some caches if I keep getting an obviously wrong "Too many arguments to if" compile error? It only happens in one place under a cond->. It compiles if I remove the if, if I move the if out of the cond->, or in another function, or if I remove the cond->. CI seems to have passed on this code as well so it looks like a local issue.


are you sure your if is playing correctly with the threading of the cond->?

🙈 4
😭 4

Oh, you mean the first arg will be threaded into the condition part of the if!


@dpsutton Thanks for the hint. I was so convinced it was a local issue because CI seemed to have passed. I just noticed I pushed to the wrong branch tho :face_with_rolling_eyes:


I guess putting ifs into a cond-> is not such a good idea then.


well the cond-> should have the test above the threading part


I was trying to avoid having thing (fn) (not thing) (other-fn).


you could put the if statement at the top around the value you are threading


(cond-> (if condition? map1 map2) ...)


Not really. The threading that goes on before is actually relevant.


Sorry for being brusque above. I'm enqueueing some pedestal interceptors so I can't move the if before.


(cond-> v condition (assoc ...) (not condition) (assoc ...)) is pretty standard


I didn't follow your (fn) (not thing) (other-fn)) stuff above.


I meant I was trying to avoid exactly your cond-> example with the thing and (not thing) predicates as I felt it looks like "bad usage for cond->".


So I tried to be smart and use an if instead 🙂


feels normal to me ¯\(ツ)


Well, sometimes I am using cond-> with just one predicate to avoid repeating things so, maybe my radar is a bit off 🙂 [edited for clarity]

Logan Powell13:08:41

I believe I'm running into issues trying to use ClojureScript code as a callback within a JavaScript Library function. Is this a typical interop issue?

Logan Powell14:08:11

perhaps I should ping the #clojurescript channel on this one?


Hmm. I've not done enough ClojureScript to be sure. I know it's not an issue with Clojure/Java, because we're doing it, but we did have to reify the thing we wanted to do so that Java saw it as a Java class with a method:

(reify Callback
    (onCompletion [_ metadata exception]
      (if exception
        (log-message :error (produce-exception-log exception))
        (log-message :debug (wrote-message-log metadata)))))
Is there something akin to reify for ClojureScript/JavaScript?

Logan Powell14:08:23

yes, there's a reify macro in cljs

Logan Powell14:08:30

I've never used it though 😄

Logan Powell14:08:37

I'll give that a go


So that was where the Java lib was expecting a callback that implemented the interface Callback (with some org.blah stuff before, but we'd imported that), which required it to provide an onCompletion function

Logan Powell14:08:39

thank you for the pointer, let me google around

Mario C.15:08:24

Question: I was reading a StackOverflow question. And in the accepted answer the responder said >Normally, I prefer to use wrapped Clojure functions, unless I have benchmarked and identified a performance problem, at which point I might drop down to direct Java interop. I always thought that Clojure code becomes Bytecode and Java code also becomes Bytecode that the JVM then runs. If so then why would someone need to drop down to direct Java interop if the both languages end up in essence as Bytecode?


Clojure is: 1. very dynamic 2. uses immutable data structures #1 means that sometimes the JVM is not able to optimize execution of the bytecode that Clojure is turned into because it can’t guess as easily what it’s trying to do. #2 means that, for certain operations, using a Clojure data structure will be much slower than using a raw typed Java HashMap or Array that you mutate


seems like they're referring to reflection, which i guess is easier to avoid with statically-typed syntax

Mario C.15:08:19

I see what you are saying! @lilactown

Mario C.15:08:41

@jgh Ive never heard of reflection. Going to google that lol

Mario C.15:08:23

Thanks guys!


Any specific reason why this fails with a `Class cast exception, trace missing: (map int (split (name :1-2) “-”))


split is from clojure.string


(int "2")
ClassCastException java.lang.String cannot be cast to java.lang.Character  clojure.lang.RT.intCast (


(map #(Integer/parseInt %) ["1" "2"])


do you have two accounts?


are you chris and Chrisp?


haha i was confused by the really appreciative lurker lol


never mind that

parens 4

the #error{:cause nil, :via [{:type java.lang.ClassCastException, :message nil}], :trace []} is not very … informative?


but, hey, thanks


so, this Integer/parseInt does not exist in cljs


but I guess it is the int that balks


js/parseInt in javascript. Integer/parseInt is a static method in the Integer class definitely jvm specific


probably want the radix in it as well. Its easy to end up with a different base depending on input


I don’t know what I`m doing wrong, since the repl balks at js/parseInt


CompilerException java.lang.RuntimeException: No such namespace: js, compiling:(null:0:0)


using Cursive


you said this was a cljs file right?


i don't know how cursive works then. did you try the Integer/parseInt? is it possible cursive thinks this is a clojure file not clojurescript?


I dunno, always have problems with the js namespace in cursive


So I guess it is something wrong I’m doing related to the setup


there's a #cursive channel to help you go through it


yes, I think thats the proper way


thanks for the input though

👍 4

What is the best/recommended way to start a new ClojureScript project? I saw the devcards template, but idk if there's a more common option.


Reading prior comments, reagent does look pretty nice.


Reagent is nice. So is Rum. In the project I am involved in we switched from Reagent to Rum because it was trickier to do server rendering of the views in the former. I think that might have changed.


Earlier today, some messages up in this channel I heard of Qlkit, which looks really interesting. I think I will try to follow that tutorial and see what I think after that:


i recommend giving #fulcro a try as well. it's a batteries-included, easier to get started with, better documented fork of Om Next. the author is active in Slack if you should need to ask any questions, and has created a detailed book, as well as a series of videos to help people learn it. cc @UC5394EGJ

metal 4

Thanks for the heads up, pez.

👍 4

I'm looking for advice on naming conventions for tests in clojure, especially for generative tests using test.check.


Anyone with experience using Need to do some real time updating stuff.


@jarvinenemil We built some real time p.o.c. dashboard stuff at work using it -- but that was several years ago.

👍 4