Fork me on GitHub
Pepijn de Vos11:08:06

Is this something that makes sense to rewrite as a transducer?

(defn find-overlapping [sch]
  (->> sch
       (mapcat (fn [[k v]] (map #(vector k %) (offset-wires v))))
       (reduce (fn [coords [name val]]
                 (update coords val conj name)) {})
       (filter #(> (count %) 1))))
I figured you can replace ->> with comp but there is no reduce that returns a transducer, so then it becomes kind of a nasty process where you turn the mapcat into a transducer, the reduce into a transduce, and then the vals+filter step into another one and collect that with into/sequence or something like that?


FWIW you could rewrite it using group-by instead of reduce. Should make it a bit more clear.


also there are tons of libraries out there which provide a map-values


Howdy, is anyone using Jest with Clojurescript? I'm particularly interested in experience with writing component tests using React Testing Library


I am also interested in this but have no news to share


We are thinking of working on integration of Jest with cljs and possibly open sourcing it but wanted to check if there's prior work


can anyone help me understand the difference between using CLJS to generate a static site versus a static-site generator like Jekyll, Hugo, etc.? Specifically the output. Are there ramifications to a JS output versus just HTML? I’m new to the SSG game (and trying to build a blog for me and my friends!)


I’d like to write Clojure or ClojureScript, using Hiccup and a CSS framework like Bulma or Tailwind, to generate static assets I can host on a CDN


If you ship JS code (one that's supposedly not used when you generate just HTML), the amount of data your readers will have to download will be larger. Unless you have large generated HTML documents that require only a little bit of code to generate. Apart from that, some rather rare Internet users simply disable JS in their web browsers. If all you require can be expressed with nothing but HTML+CSS, I would definitely go that road.


So is it feasible to write Clojure(Script) to generate HTML+CSS only?


I saw some tools, Cryogen and Static, which might be that sort of thing?


I have never dealt with SSG, but CLJ[S] is a general-purpose language, so sure. :) Yeah, I've heard of Cryogen before, seems like the right tool for the job. Haven't heard about Static.


Do you have a link to Static? Kinda hard to find with that name.


The question is framed in an odd way. You can generate a static site with any language you choose. If you are using CLJS to just generate HTML which is then served by a server, you would have just created your own SSG (Hugo et al) but in CLJS.


Are you looking to create an SSG tool or do you want to use CLJS with a SSG tool?


Neither actually, I want to create a site that I can host on a CDN or Github Pages or similar and I want to do it in either Clojure or ClojureScript. I was trying to ask about the difference between generating a bunch of HTML with an SSG versus building a conventional cljs frontend. Is it primarily SEO and artifact size? Since one has a bunch of javascript and the other doesn’t Let me know if that doesn’t make any sense because I’m new to this kind of thing


No worries. The answer to this question would be the same as with vanilla JS. So yes, if your site is a SPA then bundle, seo etc can be factors.


What kind of site are you building?


Essentially a blog


After a bit of research I think I understand the differences now. Though the hybrid approaches like Gatsby.js are pretty confusing!


100%. They don’t make it easy to see what they’re doing 😛 . If it helps at all, I just redid my blog. I used Eleventy and haven’t found a need to use JS/CLJS to enhance the blog yet. Often times there isn’t much need to flood simple sites with JS (and by extension, CLJS). CLJS is what I would add to a simple site (like a blog or marketing site) if I was just trying to learn it, or started getting to a point where I need to manage a bit of state and i’m already adding more JS libraries than it’s worth. If it’s a SPA, or Behaviour intensive site, I would opt for CLJS most times. Only other consideration is do I need to hand the site off to another developer/client without ability to find CLJS developers.


awesome, it does help, and I too was / am gravitating towards 11ty. I think I may go the route of generating HTML via hiccup though, just because I love Hiccup and why learn another templating language when I already know this one?


TMK you can add hiccup and edn to eleventy because they have a flexible templating/data processing hook in