This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-22
Channels
- # announcements (2)
- # babashka (64)
- # beginners (41)
- # calva (4)
- # cider (1)
- # clj-kondo (78)
- # cljdoc (31)
- # cljsrn (4)
- # clojars (2)
- # clojure (109)
- # clojure-germany (1)
- # clojure-italy (8)
- # clojure-nl (2)
- # clojure-spec (8)
- # clojure-uk (28)
- # clojurescript (61)
- # code-reviews (2)
- # cryogen (2)
- # cursive (23)
- # datomic (21)
- # duct (15)
- # fulcro (37)
- # graalvm (17)
- # graphql (3)
- # jackdaw (3)
- # joker (11)
- # lein-figwheel (4)
- # malli (42)
- # off-topic (97)
- # pathom (4)
- # pedestal (1)
- # portkey (3)
- # re-frame (7)
- # reagent (13)
- # reitit (2)
- # shadow-cljs (54)
- # spacemacs (1)
I'd like to know if two maps are equal but with customizing the equality for functions: I'm just interested in knowing if both values are functions, not if they are the same ones
I think I'm going to use postwalk
to replace all functions by a label in both maps, and test the resulting modified maps
If an approach where you can transform your two given maps m1 and m2 into two other maps m1-mod nad m2-mod, and the right answer you want is (= m1-mod m2-mod), works for you, I would definitely recommend that. There is no built-in way to modify how =
works on maps. You can write your own recursive comparison function that takes two maps, but then you are responsible for doing all of the recursion cases yourself, on all possible sub-collection types.
i'm missing something obvious with clojure.tools.cli/parse-opts
, i have an option defined like this: ["-c" "--config" "description" :default-fn (fn [& _] (System/getenv "CONFIG"))]
but parsing it with -c xyz
returns {:config true}
and xyz as non-consumed arg
(parse-opts ["-c" "foo"] [["-c" "--c" nil :default-fn (fn [& _] "bar")]])
;; => {:options {:c true}, :arguments ["foo"], :summary " -c, --c", :errors nil}
that's the call ^@keymone that placeholder syntax is what tells tools.cli
that you want a value-based option instead of a boolean option.
Happy to improve the docs if you can articulate what would have made that clearer to you?
@keymone PRs on GitHub are good, yes! Thank you.
yeah, i understand that now, it's just easy to miss the importance of it when reading examples and docs
I'm trying to fetch an auth token on the client side in cljs. It is a promise and I want to use that token in a request. But I'm having trouble figuring out how I can make that synchronous.. It's one little thing so I don't think it's necessary to pull in core.async just for this.
If the JavaScript to import is import { Editor } from '@tinymce/tinymce-react';
, how would I import/reference Editor in ClojureScript? I'm including tinymce-react.js in a <script> tag.
Got something started with cljsjs/draft-js
What does derefing a function e.g defn foo []) @foo
achieve?
with slightly more context #js {:default #(@loadable)}
its probably not, good point.
Hi everyone
Any ideas folks? https://clojureverse.org/t/setting-image-grayscale-cljs/5114 This might be a greater JS question, but I'm not sure... Any help is appreciated.
if you’re just using raw CLJS (no frameworks like reagent/hoplon/fulcro/etc.) then might advice would be to add-watch
the rawdata/img-data
atom
I’m not sure what the relevance of go-loop
is unless you have some other core.async
machinery that you haven’t posted
I'm using reagent... I wnted to do the go-loop
thing to update (periodically) whether an image should be grayed or not.
The data (as to whether something ought to be grayed out) comes from a REST API
Just checked out the answer on Clojureverse. Will check out watches (I have no idea what they are atm 🙂 )
go-loop
involves using and understand core.async
and channels and how to use them in your app. it's quite complex
go-loop
is working fine for me ... I'm using go-loop
to fetch data from a server periodically...
Yeah, I'm still a noob when it comes to Clojure and Cljs...
add-watch
does look like what I'm looking for!! though up until now, calling the styling function inside the watch has no affect.. but if I call it from the REPL, it works just fine :thinking_face:
hmm... going to try it right away.. thanks for the tip @U4YGF4NGM
@U4YGF4NGM dude... it worked