Fork me on GitHub

Hi all, i'm working with a Javascript object that seems to be recursive. If I println it, I get a too much recursion error. When I use js/console.log it gets printed, and there's one key that keeps nesting itself repeatedly. It seems to go infinitely. However my problem is that I want to access a specific portion of this data in the form of..

(-someChildren (-key1 obj))
This will give me a collection of objects, which also recur endlessly! But each one of these children has a property that I want. Basically I want to do this..
(map -someProp (-someChildren (-key1 obj)))
Of course this doesn't work, since it's a Javascript array. And I can't use js->clj or array-seq because of the infinite recursion. What's the best way to tackle this problem? One solution I could think of is using Clojure's loop + .pop until the array is empty, but maybe there's a cleaner way?


if it’s a JS array you can just call JS , can’t you?

(.map (-someChildren (-key1 obj))
      #(-someProp %))


Ah wow, I feel pretty silly haha. Forgot JS has a map method. I think that would work, thanks 🙂


glad I could help 😉 cheers


JS interop is really quite nice in ClJS, but it’s easy to forget about when you write Clojure all the time 😉


Well I'm honestly not an expert in Javascript anyway 😄


Hello everybody, I need some help in end to end testing in clojurescript using shadow-cljs. I saw this for doo is it possible to do something similar for shadow-cljs? I would like run the cljs tests from the test environment of the clojure backend, is that possible or should I migrate to doo?


is there an example or walktrhough somewhere of starting a cljs repl from a clojure repl (not from the command line)?


But it seems like this might just start a server?

Alex Turok13:03:49

I haven’t done any cljs for long, but used to do things as outlined in weasel’s readme. Worked for me - you may try it:


Thanks, but I'm specifically trying to get it to work with no external deps besides cljs. Which I know is possible somehow 🙂 It works if I use clj -m cljs.main from the command line. Just trying to cheat on reverse engineering that


Hi all. Having headaches with cljs-http. I'm playing with ring-compojure and got a server running on localhost:3000. I can make requests to this server via postman / direct in the browser and getting valid json responses. If I try the same request with cljs-http, I'm getting an empty response: '{:status 0, :success false, :body "", :headers {}, :trace-redirects ["http://localhost:3000/..." "http://localhost:3000/...."], :error-code :http-error, :error-text " [0]"} ' what could I be missing. I've looked around to no avail. This "(go (let [response (<! (http/get "" {:with-credentials? false }))] (prn response)))" however works. Only when I use my endpoint do I get this funny empty error.


Turned out to be a CORS issue. Adding cors middleware on the ring server fixed the problem.


Anyone know how to use macros from an external, depended upon library with cljs.js/eval-str ? Is it possible to do it without using the source string? Ie, I want to use the library inside cljs.js/eval-str how do I do this?

(cljs.js/eval-str state
(ns myns (:require-macros [javelin.core]))
(def xx (javelin.core/cell 123)) 
@xx ;;works
;;(def yy (javelin.core/cell= (+ xx 123))) ;;cell= is a macro
;;@yy ;;doesn't work
                  {:verbose    true
                   :source-map true
                   :eval       cljs.js/js-eval 
                  (fn [{:keys [error] :as res}]
                    (if error
                        (println error)
                        (println (.. error -cause -stack)))
                      (println res))))


anybody working with three.js & shaders / cljs / reagent? I've kind of gotten a hang of it but I'm still looking for guidance on how you've packaged your shaders and how you are manipulating the values? seems obvious to put the manipulatives in an atom but if there are any examples on how you've maybe structured the manipulation code and multiple shaders together, I'd be interested in taking a look


this is maybe too far from your model, but I ported a few react-three-fiber demos to cljs: it is using modern react, so all shader updates would be implemented in react hooks - but none of ported demos needs that


also using shadow-cljs so I’m able to keep shader sources as separate files and embed them into compiled cljs via inline macro:


you could do it in clojure macro as well, but this method is compilation-cache friendly


thanks @U08E3BBST last time I looked at the react-fiber not to mention the cljs pieces, it didn't look quite ready for primetime. shader updates in react hooks sounds great though. can you say anything about the performance compared to the stack renderer, perhaps especially related to three.js?


unfornutaly I cannot, this is the only toy project I have at the moment, and I’m new to three.js


alright, thanks anyway. I'll keep your project in mind