This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-04
Channels
- # announcements (5)
- # aws (12)
- # beginners (76)
- # boot (29)
- # cider (24)
- # circleci (9)
- # clojure (64)
- # clojure-dev (27)
- # clojure-europe (3)
- # clojure-houston (1)
- # clojure-italy (33)
- # clojure-nl (19)
- # clojure-poland (1)
- # clojure-spec (6)
- # clojure-uk (20)
- # clojurescript (103)
- # clojutre (1)
- # code-reviews (60)
- # cursive (76)
- # data-science (20)
- # datomic (20)
- # duct (58)
- # figwheel-main (4)
- # fulcro (36)
- # graphql (6)
- # kaocha (4)
- # onyx (1)
- # pathom (15)
- # quil (3)
- # re-frame (15)
- # reagent (15)
- # reitit (9)
- # remote-jobs (2)
- # rewrite-clj (16)
- # ring-swagger (7)
- # shadow-cljs (132)
- # spacemacs (12)
- # sql (5)
- # vim (9)
- # xtdb (12)
- # yada (4)
Probably because then (into something) is the same as (into something []) ?
@schmee I saw your announcement of daguerreo. Since tasks typically take a little while, and have side effects, it would be nice to have a mechanism to check that I have specified the correct dependencies. Now, if I need :diced-mango (in the README example) I need to specify :dice-mango as a dependency. And I need to know that :blend is the task that provides me with :smoothie, etc. Have you any thought on how to accomplish any "integrity" check of the job?
hey, thanks for checking out Daguerreo! tasks are validated before they are run to ensure that all dependencies that are specified are present. as for ensuring on a key level, there is nothing like that yet. Iāve been toying around with the idea of specifying :input
and :output
to tasks, to say that āthis tasks provides these outputs and requires these inputsā, but I havenāt decided whether to put that in or not. Is that something you would find useful?
@schmee If I would use Daguerreo I would add something like that to it. I would probably even write a macro to handle the common case, i.e. takes a bunch of keys and writes to a single key. Something similar to prismatic's graph fnk
macro, perhaps.
now I can't use remove-tap
to get rid of the initial tap fn, because #'my-tap
points to the new fn
under the hood there's a clojure.core/tapset
atom which holds all the taps, but even that's private so I can't reset it without resorting to some namespace hack
iiuc, there isn't an idiomatic way -- what you mentioned at the end about the namespace hack is the only way i know of -- happy to hear otherwise š
here's the ugly hack I used:
(binding [*ns* (the-ns 'clojure.core)]
(eval '(reset! tapset #{})))
that's pretty unfriendly for a REPL-driven development workflow š I just started trying to use tap>
and immediately ran into this issue
i agree it is inconvenient and unfriendly -- i wish i knew more about the background design for tap>. my sense was that there was something intentional in not providing a key when registering the function originally (like with add-watch). may be it's a good question for ask.clojure?
Would there be a reasonable way of writing something like python's functools.wraps
in clojure?
im occasionally frustrated that the naming of wrapped functions goes to annonymous gibberish
@emccue you could pass the :doc and :arglists keys of the original function metadata to the new function
@emccue You want a macro for that. You can resolve the symbol to its var and get the metadata.
oh. if the function is passed in then you don't even need macros, you already have the function "object" in your hands
Funny encapsulation experiment:
(ns encapsulate)
(defn encapsulate [x]
(if (instance? clojure.lang.IObj x)
(let [ns *ns*]
(vary-meta x assoc :type ::encapsulated ::ns ns))
x))
(defmethod print-method ::encapsulated [x writer]
(if (= *ns* (::ns (meta x)))
(print-method (vary-meta x dissoc :type ::ns) writer)
(print-method "***" writer)))
(ns boop)
(def x (encapsulate/encapsulate {:a 1}))
(prn x) ;; => {:a 1}
(ns woop)
(prn boop/x) ;; => "***"

I know there is a popular idea that there is no much value in encapsulation when all you have is immutable values, but I still sometimes find it useful to use "soft" encapsulation as a way to say "treat this value as a black box, it's shape is implementation detail that belongs to that namespace only"
is there anyone using Open JDK in production with Clojure? what are the odds of oracle changing its license and end up killing it? I ran into this discussion today with one of my friend who is moving from JVM to Elixir/beam. because he does not trust oracle anymore.
I don't have much experience with JVM and its ecosystems. I am looking for your thoughts and point of view. Thanks
Used OpenJDK, using amazon corretto for some stuff now
ever since I upgraded java from 8 to 12 I've been getting a lot of errors in lein plugins:
Caused by: Syntax error compiling deftype* at (clojure/core/rrb_vector/rrbt.clj:282:1).
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7115)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
Caused by: java.lang.IllegalArgumentException: Must hint overloaded method: toArray
at clojure.lang.Compiler$NewInstanceMethod.parse(Compiler.java:8497)
yeah, they added a new Collection toArray arity that made certain calls ambiguous re reflection that were not previously ambiguous
that particular error above was fixed in latest rrb-vector iirc
so I have added dependency to rrb-vector 0.0.14, now it works
Is there a function somewhere to test whether one nested data structure is a subset of another? e.g. if the left has a key, the right must, recursively?
I do not know of anything exactly like that included with Clojure. clojure.data/diff has some similarities to what you are asking, but looks for differences recursively between two values.
If not, you can copy its code and tweak it to your heart's desire.
I have a function kind of like that here: https://github.com/clojure/spec.alpha/blob/master/src/test/clojure/clojure/test_clojure/spec.clj#L17
specifically for nested maps really. this is testing code so it's kind of tailored to the job of "is the stuff I'm looking for a subset of the nested maps that I got"
well, same situation here: characterization tests that ensure that I don't break existing bus messages, where I can add fields but not remove them or change them.
diff ends up being nice, because I can say (is (empty? (unmet-requirements msg requirements)))
, where unmet-requirements
returns just the things only in requirements.
also perhaps nice to print/save the differences if a problem arises, for debugging
there are interesting choices for stuff like this in collection values. Rich and I have talked about adding something like this to clojure itself (flip the args and maybe call it subsumes? or something)