This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-04
Channels
- # announcements (5)
- # beginners (205)
- # calva (1)
- # cider (48)
- # cljs-dev (9)
- # clojure (123)
- # clojure-berlin (1)
- # clojure-europe (2)
- # clojure-italy (5)
- # clojure-nl (6)
- # clojure-russia (7)
- # clojure-serbia (1)
- # clojure-spec (8)
- # clojure-uk (33)
- # clojurescript (134)
- # cursive (5)
- # datomic (31)
- # emacs (5)
- # figwheel-main (61)
- # fulcro (10)
- # hyperfiddle (23)
- # jobs-discuss (24)
- # klipse (1)
- # lein-figwheel (3)
- # midje (5)
- # nyc (1)
- # parinfer (2)
- # pathom (14)
- # pedestal (12)
- # re-frame (46)
- # shadow-cljs (24)
- # spacemacs (1)
- # tools-deps (37)
- # vim (4)
- # yada (22)
Is there a semi-canonical list of heavily used ClojureScript libraries in need of better documentation?
@lilactown that's what I was saying earlier, can't work
well, I think I can probably get around this by creating my own JS event bus and just accessing it through goog.object
I’ll have to fiddle with this. serializing and reading the data I want to send on the channel is not a big deal
well I'll just offer my opinion that I don't think getting multiple ClojureScript builds to work together is worth the trouble
well, with the way I’ve written the application right now I feel like it’s worth it.
it’s a dev tool, meant to be used alongside your app. but it has it’s own set of dependencies, e.g. it’s using an alpha version of React, that I don’t want to burden the user with configuring
much easier to just put a script tag on the page and include a dependency that does the bit of interop to setup the communication channel
if you're going down this path then I think the only thing that won't lead to a lot of headaches is to completely isolate the different builds and have them talk via JSON/Transit/EDN
which is fine. the idea is to have it run in a separate window, or maybe even a chrome extension, later on. plus, I want to support Node.js and (stretch goal) JVM Clojure which would necessarily have to serialize the data anyway
Uncaught Error: No protocol method IAssociative.-assoc defined for type cljs.core/IndexedSeq: ({:number-of-ratings 0, :title "You can listen to lots of audiobooks for free online at librivox", :posted-by "jade", :link
??? o.o
so i have a collection of maps
and i want to conj on all these maps i have
but they come packaged as ({:maps ""} {:maps "x"} {:maps "z"})
how can i conj all those maps into my clientside atom?
confuzzled
You want to conj something to the value of the :maps key? Or onto each map in the list?
I'm looking for this thing that analyzes CLJS source maps and spits out how much each namespace etc takes up — anyone has a pointer to that?
@martinklepsch https://www.npmjs.com/package/source-map-explorer or https://shadow-cljs.github.io/docs/UsersGuide.html#_build_report
@lilactown just trying to join two vectors of maps into one. but one looks like [ { } {} {} {} {} ] and the other like ( {}{}{} )
@sova A tiny example of the two inputs and the desired output would help sort out exactly what is needed
(def daytuh (atom [{:id 7 :summary "Zed" :comments [ ] }
{:id 8 :summary "Penguin" :comments [ ] }]))
Now a user initiates an action to write! a new comment to the db. new comments have their own :id, like 99.
At the end of an action where the user is commenting on post with :id 8
the atom should look like:
@daytuh= [{:id 7 :summary "Zed" :comments [ ] }
{:id 8 :summary "Penguin" :comments [ 99 ] }]))
And at the end of another action where another user makes a new comment with :id 177
on post with :id 8
@daytuh= [{:id 7 :summary "Zed" :comments [ ] }
{:id 8 :summary "Penguin" :comments [ 99 177 ] }]
Dang. Too bad your data isn’t a map keyed by ID instead, then you could just directly do
(update-in {7 {:summary "Zed" :comments []} 8 {:summary "Penguin" :comments []}} [8 :comments] conj 99)
@sova With the shape of your data, it seems that you will have to do a scan. For example,
(defn scan-idx [k v coll]
(reduce-kv (fn [_ idx m] (when (= v (k m)) (reduced idx)))
nil
coll))
then
(let [data [{:id 7, :summary "Zed", :comments []} {:id 8, :summary "Penguin", :comments []}]]
(update-in data [(scan-idx :id 8 data) :comments] conj 99))
But that’s less than ideal.

I'm fine with it for the time-being. Putting some sort of index on the data is too opinion'd a stance for the moment
and thank you, that helps a lot
Okay I keep getting errors on
indexed Seq
ncaught Error: No protocol method IKVReduce.-kv-reduce defined for type cljs.core/IndexedSeq:
@sova this is bread and butter use case for specter:
user=> (def data
(atom
[{:id 7 :summary "Zed" :comments [ ] }
{:id 8 :summary "Penguin" :comments [ 99 ] }]))
user=> (setval [ATOM ALL #(= 8 (:id %)) :comments AFTER-ELEM] 177 data)
user=> @data
[{:id 7, :summary "Zed", :comments []} {:id 8, :summary "Penguin", :comments [99 177]}]
@mfikes (swap! tv-state vec) solved my problem
Is it possible to assign a clojure to a javascript property from cljs? I want to do something of the form:
obj.f = (x) => x + 1
I am thinking of trying to build a self-hosting clojurescript page with a custom web-based repl using cljs.js/eval-str
, but I've not tried this before. Are there any caveats or limitations I should know of running clojurescript this way (aside from obviously having a fixed set of dependencies, large download, potential to hang the browser tab...), or should it all 'just work'?
basically something like https://jscl-project.github.io/ (which has all the issues mentioned above, too).
note fixed set of dependencies is not really a limitation - bootstraped ClojureScript was designed to load dependencies after the fact
well we won't load them for you, just it assumes they will have to loaded asynchronously somehow
@mseddon If you are doing it for fun / learning, then cool! If you need this for something else and want to quickly end up with a working solution, this stuff under this page is a reusable library https://clojurescript.io
Cool. Self-hosted ClojureScript is still the deep-end of the pool, where the opportunity for maximal learning exists 🙂
@mseddon I have just made https://re-find.it which is a really limited REPL (only the READ EVAL PRINT part, not the Loop). It was the first time I used self-hosted CLJS and it was pretty easy to get going
http://app.klipse.tech is more advanced in terms of REPL experience and it also supports loading libraries from external sources from the web
http://repl-interactor.netlify.com is the beginnings of my web based repl. Except currently I've basically built a clojure syntax highlighting/auto indenting edit box from scratch atm
There are other cool applications of self-hosted too https://ctford.github.io/klangmeister/ for music Timothy Pratley’s turtle thing https://www.youtube.com/watch?v=0fKpGy2QuMM
and there’s https://www.maria.cloud/
I was trying to lower the size of the compiled artifact, it’s now around 8MB in size un-gzipped, 1MB gzipped
Tried these: https://clojurescript.org/guides/self-hosting, but ran into https://dev.clojure.org/jira/browse/CLJS-3021
yeah, it’s already pretty good. most mobile phones can download 1 MB below a second I reckon
Well. A little cljs repl that sits on the home screen. I don't think service workers would really add much other than being manditory to get there
@mseddon for highlighting, paren matching, etc. I used codemirror, it’s what Klipse also uses
Though I did it from scratch since I can perf tune it a little better. Codemirror on mobile is a bit slow on account of being quite backwards compatible
https://github.com/BetterThanTomorrow/repl-interactor that is my plan :)
Also I can see this being useful for people hosting python etc. Typescript makes it a bit more accessible
something that handles pretty-printing, syntax highlighting, and all the fancy input problems. that I can embed in an application
@lilactown FWIW codemirror + parinfer plugin gets you there already?
I’ve played with codemirror but not sure how it handles all of the interactions one wants at a REPL yet. so maybe I’m already 80% there 🙂
I just think it would be cool to be able to install a single CLJS dep, setup the bootstrapping, and have an embedded REPL in a drawer or separate browser window
@lilactown you can already embed Klipse right?
klipse seems optimized for embedding within a blog-like thing. there’s a lot of work to be done to create a more terminal-repl-esque UI.
I’m not lamenting the lack of options for running CLJS in the browser. I’m talking about the fiddly UI problems 😉
would be cool on http://clojure.org or something 😉
or something -> http://clojurescript.org makes sense 🙂
That’s what http://clojurescript.io essentially was
Is Replete available for Android now?
Are there any guides on how to build Javascript npm package around a ClojureScript library?