This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-09
Channels
- # aws (3)
- # babashka (48)
- # babashka-sci-dev (1)
- # beginners (143)
- # calva (62)
- # clj-kondo (6)
- # clj-otel (3)
- # cljs-dev (59)
- # cljsrn (4)
- # clojure (39)
- # clojure-austin (5)
- # clojure-europe (60)
- # clojure-losangeles (1)
- # clojure-nl (2)
- # clojure-romania (4)
- # clojure-spec (3)
- # clojure-uk (2)
- # clojurescript (32)
- # datomic (17)
- # events (3)
- # figwheel-main (4)
- # graphql (3)
- # gratitude (2)
- # holy-lambda (52)
- # introduce-yourself (3)
- # jobs (1)
- # juxt (5)
- # kaocha (2)
- # lsp (33)
- # nyc (3)
- # off-topic (9)
- # other-languages (4)
- # overtone (1)
- # portal (21)
- # reitit (2)
- # remote-jobs (5)
- # shadow-cljs (65)
- # tools-deps (2)
- # xtdb (8)
Morning!
Morning
Good morning!
I have a function that takes (f {:arg-1 val-1 :arg-2 val-2})
and I'd like it to also take (f val-1 val-2)
should I have the one that takes the map call the one where order matters or should I take the one where order matters and put the values into a map? Or is there a new clojure 1.11 magic way of handling this that I don't understand yet?
calling (f :arg-1 val-1 :arg-2 val-2)
feels about as painful as putting things in the map, but might be faster I suppose? idk 🤷
but personally I don't think it's worth supporting (f :arg-1 val-1)
vs. (f {:arg-1 val-1})
- always using a map gives less headaches imo
Using fixed args is better for performance as no destructuring needs to happen, so I would have the map version call the fixed args one, if possible, and leave the fixed args one to do the least amount of work possible to process the args. If performance is a concern. If you are going to do an http request or database query in that function, none of this matters.
it isn't the most performance sensitive bit of the code, but I was more wondering about the general principle as some of the bits will be very performance sensitive, so I at least want to avoid the big hits even if I do take some hits for expressiveness
You can cheat and provide a user friendly API with a map and an inline meta that will examine the call site and unpack a literal map to positional
I'm not sure what that inline meta would look like. I know how to do the overloading though
Morning!
Would you rather (A) (->> ... (mapcat identity) ...)
or (B) (->> ... (sequence cat) ...)
? Discuss
there is a deep discussion of this at https://chouser.us/apply-concat/ Personally I have a 🐈 🙂
not really in this context
Seriously, I think I'm going for (A), less abstract, more accessible to future readers
This example confirms it: the ElasticSearch Bulk API can definitely be described as 'something gone funky'
Probs doesn’t solve the upstream problem, but it would sometimes be nice with a flatten1
which only did (mapcat identity...)
> Yeah the whole json-but-not-actually-json thing is fun That, and having 2 values, one for identifying the document and one for writing to it And the whole schema of "you will find the operation type as the key in the only entry of the map"
https://www.studentnewsdaily.com/wp-content/uploads/2015/05/clowns-820x555.png is my favorite clown car. Much because of the duck on top. Don’t ask why.
Little bit late to the party 🙂 https://youtu.be/sR_rPd_ufK4
It's amazing to see #joyride used for providing the #portal UI as a data inspector to #calva. https://github.com/BetterThanTomorrow/calva/issues/1717 Despite both Portal and Calva lacking API for it. A true Joyride of those two tools! @orestis 👑
I wonder if the Calva team will shift into writing more CLJS now that you can have a REPL
Probably not. We always run into troubles using the vscode API from ClojureScript. The mix of TS and CLJS seem not to allow it. While it is fine in Joyride which is pure CLJS.
I enjoy the REPL a lot when working with the ClojureScript parts of Calva though, so this with extension authoring using the REPL is not new to me. 😃
And maybe with some API on the Calva extension we can write some high level functionality with Joyride.
Yes, a lot of things will be possible with a first class Calva API for certain things. Probably more around evaluation rather than eg editing or highlighting.
there is a deep discussion of this at https://chouser.us/apply-concat/ Personally I have a 🐈 🙂