Fork me on GitHub
#clojurescript
<
2022-05-16
>
genRaiy15:05:05

regarding promesa is recursion supported (eg via loop / recur or reduce)? I can get it to work with function recursion but I'm worried about blowing up the stack at some future date

genRaiy15:05:29

(defn fetch-all
  [api-url search-conditions]
  (loop [page 0
         result []]
    (p/let [search-conditions' (if (zero? page) search-conditions (conj search-conditions ["page" page]))
            {:keys [content pagination]} (fetch-borrowers-page api-url search-conditions')
            {:keys [page totalPages]} pagination]
           (if (= page (dec totalPages))
             (concat result content)
             (recur (inc page)
                    (concat result content))))))

genRaiy15:05:43

I get this error... when I try to run it with nodejs

genRaiy15:05:59

internal/process/esm_loader.js:74
    internalBinding('errors').triggerUncaughtException(
                              ^

genRaiy15:05:44

oh and I'm running on nbb if that makes any difference

Alexis Schad15:05:20

I don't know promesa but I think if you use async code, you must use it all the way up. Try using p/loop and p/recur

genRaiy15:05:06

Ha - I didn't know it had those constructs. Thanks

Alexis Schad15:05:13

and therefore fetch-all will be async too, its inevitable.

genRaiy15:05:34

yes, that's as expected

👍 1
genRaiy15:05:41

actually it was an issue with nbb

genRaiy15:05:42

they don't yet have p/loop and p/recur but knowing @U04V15CAJ it will be there already 🌪️

Alexis Schad15:05:00

ho ok you're speaking about nbb

1
borkdude17:05:08

Now available in nbb 0.5.103

🌪️ 2
phill16:05:56

Does figwheel-main already work with ClojureScript 1.11.51 or will it need adjustment due to the removal/vendorization of data.json etc.?

bhauman16:05:53

@phill its missing clojure.data.json so I’m adding that right now,

bhauman16:05:49

@phill there is also a CLJS classpath problem that is being fixed and released promptly in ClojureScript 1.11.54

domparry16:05:59

That was quick.

dnolen16:05:18

1.11.54 should be available soon if not already - a minor tweak for a Figwheel bug report from @bhauman

James Amberger19:05:12

I am a JS refugee who made extensive use of RxJS in my largest project.

emccue19:05:31

im sorry for your loss

curlyfry20:05:11

What is the motivation behind vendorizing clojure.data.json etc? I looked at the ticket but it didn't seem to contain any of the underlying reasoning https://clojure.atlassian.net/browse/CLJS-3372

p-himik20:05:08

According to some previous discussions here - performance. It's not just vendored, it's AOT compiled.

phill21:05:41

The release notes https://clojurescript.org/news/2022-05-13-release go into some detail on the subject

dnolen03:05:14

AOT is about load time for CLJS - vendorizing is about avoiding dep conflicts which can't be resolved in a sensible way

👍 2
Yehonathan Sharvit02:07:27

I am late in the party. What does it mean exactly to vendorize a namespace?

p-himik06:07:10

Copy it into your own sources and change the namespaces so that there are no conflicts with the same lib brought in as a dependency.

Yehonathan Sharvit06:07:39

Thank you for the clarification @U2FRKM4TW

curlyfry20:05:14

Also, does it mean that I now have to include an explicit clojure.data.json dependency if I'm using it in my project?

p-himik20:05:56

Yes, fortunately.

💯 1
dpsutton20:05:47

That has always been the case. If you require a dependency, you should explicitly list it in your deps.edn/project.clj/pom file.