Fork me on GitHub

so I’m hunting for a good feature flags / dark launch lib and the Java lib page on is a bit sad-looking, and there’s no category at all on clojure toolbox. Anyone have any good recommendations? I’ve rolled my own in the past but I’m hoping I don’t have to again.


I'm implementing datafy for a deeply composite/nested class and have noticed that for a fair amount of the subclasses that bean is getting me pretty close to where I need to be. Is there any reason why these two are separated? I am thinking that datafy should maybe call bean on types that don't implement the protocol


Right now Datafiable has just six implementations: Throwable, IRef, Namespace, Class, nil, and Object -- the last one being the "default behavior" (of doing nothing) for any type that isn't one of the others.


So datafy only works for things that implement the protocol (because it's a protocol function) but that includes the Object "God Type`.


To have calling bean make sense, you'd have to specialize datafy (implement the protocol specifically) for a lot of types where you actually do just want the underlying object back -- basically every single type that represents data. Number, Map, Array, String, and hundreds more.

👍 4

As an example @UF9E03ZEX if you call bean on a String:

user=> (bean "hello")
{:bytes #object["[B" 0x87cb1d8 "[[email protected]"], :class java.lang.String, :empty false}
which is definitely not what you want.



user=> (bean 1234)
{:class java.lang.Long}


Looking at old code is often a reminder of one's earlier ignorance. I probably wouldn't write a function like this again today:

(defn hash-from-pairs [pairs]
  (zipmap (map first pairs) (map second pairs)))

🌟 4

Not that it is wrong, just that (into {} pairs) would do.


hi, I have this issue. I open two different app's routes in two different tabs. I would like to set different cookies on those tabs. However they also get overwritten with last page loaded. if add :path "whatever", it does not appear in browser cookies. Why? Is there a way to resolve this?


Hi all, i was asking me the meaning of the ns irresponsible, e.g , is the clj-commons org behind this or it is only for special projects?


e.g I see that project belong to clj-common now, but other projects of this organization are named as expected like


my simple question is why the naming irresponsible/tentacles for that project, or it is a name convention I'm missing? :thinking_face: tia


I don't know the story, but will make a guess that some time after it was owned by Raynes, it was taken over by someone with a Github user id of irresponsible, and from there it moved to be under clj-commons.

clj 4

There is at least one commit around 2017 some time changing a line in the README from Raynes/tentacles to irresponsible/tentacles, and a 1-sentence explanation of why it changed maintainership then.


thx Andy for this!


we might change the namespace to clj-common then


Hi @UHHHJ7FFX, thanks for you contribution. I raised the same question into #clj-commons after you submitted your PR 😄

clj 4

so feel free to join the discussion there


thx ! reading


I was even not awayre of the channel


yes thx nate for sharing. Really sad about it when discovered


ok! thx. so it was a coincidence of a special ID of github 😁


when using clojure + tools.deps as a cli, what workflow would you recommend for quickly adding deps on the fly


You need a special version that has add-libs


I tend to always have a repl running but end up restarting it everytime i want to change the deps profile


is there a an out of the box way to read edn string containing aliased shortened keyword ::foo/bar into edn clojure data structure verbatim? or will it always try to expand into qualified keyword based on aliases in current namespace, where read is happening?

Alex Miller (Clojure team)12:06:56

edn does not support auto-resolved keywords at all

Alex Miller (Clojure team)12:06:47

:: keywords are not part of edn

Alex Miller (Clojure team)12:06:53

if you want to read files using the clojure reader as clojure data, then you can set the reader up with a custom resolver, but the resolver is still going to resolve to a keyword (not an autoresolved keyword)

Alex Miller (Clojure team)12:06:38

generally, I find it best with edn data on disk to just use fully-qualified keywords


yeah, seeing Schrödinger keyword in string is a bad news indeed.


Are there any subtle/interesting/non-obvious examples of functions of data sets that can be calculated in parallel using Clojure parallel reducers, or "almost can" but cannot be done so correctly? Is it the same class of functions that you can use something like Hadoop or Google Map-Reduce to calculate, I guess?


take/drop can be implemented by lifting the ordering requirement


ok, that definitely isn't obvious to me 🙂

Alex Miller (Clojure team)17:06:05

assuming you don't care which you get :)


My brain is limping along trying to figure out how, and it is probably because I'm missing something pretty big about reducers. The data set is split up into blocks that are each processed in parallel, with no information passing between the parallel threads (yet). Each calculates a result, which is then combined together with the others via the user's provided function. That function is just counting number of kept/dropped elements during combining?


I might be off even there.


if you haven't seen tesser it is a neat library that isn't based on reducers/transducers but is another way of specifying folds (I think released around the reducers time frame) that can run the folds in parallel or generate hadoop map reduce jobs, and it has interesing fold combinators that can be implemented for reducers/transducers but don't exist in the standard library


facet and fuse are really neat


Thanks for that pointer -- I had not heard of it before. The README docs have fun-looking not-commonly-seen-style of figures for on line docs.


Hello! Can someone please point me what I am doing wrong?

(defrecord Hex [bytes])

(defn to-hex [bytes]
  (->> bytes
       (map #(format "%02x" (byte %)))
       (clojure.string/join "")))

(defmethod print-dup filter_db.core.Hex[o w]
  (.write w (str "#hex[" (to-hex (:bytes o)) "]")))

(defrecord Record [hex])

(defmethod print-dup filter_db.core.Record[o w]
  (.write w (str "#record[" (:hex o) "]")))

(binding [*print-dup* true]
  [(pr-str (Hex. (into-array Byte/TYPE [0])))
       (Hex. (into-array Byte/TYPE [0]))))])

; actual -> ["#hex[00]" "#record[[email protected]]"]
; expected -> ["#hex[00]" "#record[#hex[00]"]


@lboliveira Because inside the print-dup for your record, you're just calling str on the hex object, so it doesn't go through the print machinery.


Change (:hex o) to (pr-str (:hex o)) and I think it'll work as expected.


thank you 😃