Fork me on GitHub

What is the difference between cljs-devtools and dirac-devtools?


It seems dirac includes more functionality, integrates chrome repl with nrepl etc…


Can you use dirac with shadow-cljs?


There's also #dirac

👍 3

btw. dirac 1.6.0 added support for shadow-cljs REPL:

🎉 3
Sam Ritchie14:08:16

Hey all - I have a few spots in sicmutils where I implement IFn, and override all 21 arities: Is there a more straightforward, idiomatic way to do this, like Clojure's override of (applyTo [s xs] (AFn/applyToHelper s xs))

Sam Ritchie14:08:46

I could write a macro of course, but maybe there is something cleaner


@sritchie09 IFn etc in ClojureScript still need work, it's languished because it has considerably less utility due to ClojureScript fns being JavaScript fns


that is we don't dogfood it, and it's kind of a power feature and few patches 🙂

Sam Ritchie15:08:58

yes, makes sense for the usual case. here, we do things like make a tuple that acts like a juxt and a seq, so ((up inc square dec) 10) => (11 100 9) , etc

Sam Ritchie15:08:29

makes sense! @dnolen I definitely felt a little power coursing through the keyboard as I typed the final character of the 21st arity


if you look at JIRA you'll see there's some basic outstanding things missing


all of intermediate level difficulty


calls w/ more than 20 args need to be reshaped


internal fn dispatching probably needs to be fixed


then IFn can work


there's a bunch of tests now so wouldn't be surprised if you have to chase some issues w/ apply


so a surprising amount of work for something that's not used that often


because again regular fns don't need it

Sam Ritchie15:08:38

thanks for the heads up, as I start to test this more maybe this can be a first contribution area for cljs

Sam Ritchie15:08:30

I recently found a very minor fn typo in Lisp in Small Pieces and got myself on the errata list, so I'm feeling pretttty solid about my compiler hacking abilities


but in all seriousness patches here would be welcome


been in my queue for years but more pressing things to do

Sam Ritchie15:08:41

👍 yes, absolutely, if I find anything (even if not, I'll look for it) I'd be thrilled to contribute


Trying to get vega-embed working in cljs/shadow.

(:require ["vega" :as v]
          ["vega-lite" :as vl]
          ["vega-embed" :as vegaEmbed])
(let [vspec (->> {
                  "$schema"     "https//",
                  "description" "A simple bar chart with embedded data.",
                  "data"        {
                                 "values" [
                                           {"a" "A", "b" 28}, {"a" "B", "b" 55}, {"a" "C", "b" 43},
                                           {"a" "D", "b" 91}, {"a" "E", "b" 81}, {"a" "F", "b" 53},
                                           {"a" "G", "b" 19}, {"a" "H", "b" 87}, {"a" "I", "b" 52}
                  "mark"        "bar",
                  "encoding"    {
                                 "x" {"field" "a", "type" "nominal", "axis" {"labelAngle" 0}},
                                 "y" {"field" "b", "type" "quantitative"}
  (-> (vegaEmbed chart-div vspec (clj->js {:renderer "canvas"
                                          :mode     "vega-lite"
                                          :logLevel v/Debug}))
      (.then (fn [_]
               (log/info "DONE WITH VEGA")))
      (.catch (fn [e]
                (log/error "ERROR IN VEGA" e)))))
Is giving me
TypeError: this.globalCursor is not a function
and points to this line in vega: Anyone have any hints?


@jjttjj just a guess but since it wants to use this maybe vegaEmbed. not vegaEmbed? hmm nevermind if it returns a promiseI guess not 😛


Whats the most "popular" web framework for clj/cljs these days?


probably #fulcro or #re-frame

👍 3

Can anyone point me to the magic incantation to load a npm-deps like @angular/core? I'm actually trying to import @myorg/mylib and not having any luck. I can get react to work through. I'm trying @angular/core to verify that the mechanism works on a public library with an org/name but no joy. I've tried

:npm-deps {"react" "16.13.1"
           "@angular/core" "10.0.12"}
With and without the @ and also
   [react :as react]
   ["@angular/core" :as ass])
with and without the @ - any pointers?


Have you tried using :target :bundle instead of :npm-deps and then try your require? :thinking_face: Example:

Oliver George23:08:39

I'm looking for a clever way to make my js/console.log display cleanly with and without cljs-devtools installed

Oliver George23:08:59

Feels like it should be possible by using something like this...

(defn console-logger
  (binding [*print-level* 3 *print-length* 5]
    (js/console.log (with-meta (pr-str data) {:data data}))))

Oliver George23:08:19

if cljs-devtools is installed you can drill into metadata

Oliver George23:08:01

String form will work in all situations and not take too long to serialize

Oliver George23:08:22

Obvious problem is that string doesn't implement the metadata protocol

Oliver George23:08:06

I think the answer is something like: why not just specify! that protocol.

Oliver George23:08:12

No joy with this. I'm guessing cljs-devtools tests for string before falling back to fancy behaviour. Looks like specify! doesn't work on a string.

(defn log-data
  (binding [*print-level* 3
            *print-length* 5]
    (js/console.log (specify! (pr-str data) IMeta (-meta [_] data))))))