This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-21
Channels
- # announcements (9)
- # beginners (222)
- # boot (11)
- # calva (40)
- # cider (1)
- # clj-kondo (10)
- # cljs-dev (1)
- # cljsrn (8)
- # clojars (4)
- # clojure (50)
- # clojure-dev (4)
- # clojure-ecuador (1)
- # clojure-europe (4)
- # clojure-italy (3)
- # clojure-madison (2)
- # clojure-nl (26)
- # clojure-spec (86)
- # clojure-uk (34)
- # clojurescript (11)
- # clr (1)
- # cursive (46)
- # datomic (19)
- # emacs (4)
- # events (1)
- # fulcro (22)
- # graalvm (4)
- # graphql (2)
- # jobs-discuss (40)
- # leiningen (10)
- # luminus (6)
- # nrepl (7)
- # off-topic (18)
- # onyx (6)
- # overtone (1)
- # pedestal (2)
- # planck (1)
- # re-frame (5)
- # reagent (3)
- # reitit (8)
- # rewrite-clj (2)
- # shadow-cljs (139)
- # sql (4)
- # tools-deps (42)
so I’m hunting for a good feature flags / dark launch lib and the Java lib page on http://featureflags.io/java-feature-flags/ 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.
As an example @UF9E03ZEX if you call bean
on a String
:
user=> (bean "hello")
{:bytes #object["[B" 0x87cb1d8 "[B@87cb1d8"], :class java.lang.String, :empty false}
which is definitely not what you want.Similarly,
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)))
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. https://github.com/ring-clojure/ring/wiki/Cookies 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 https://clojars.org/irresponsible/tentacles , 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 https://clojars.org/clj-commons/secretary
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.
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.
Hi @UHHHJ7FFX, thanks for you contribution. I raised the same question into #clj-commons https://clojurians.slack.com/archives/CE1A21MPF/p1561109199002400 after you submitted your PR 😄
Yep @andy.fingerhut has it
when using clojure + tools.deps as a cli, what workflow would you recommend for quickly adding deps on the fly
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?
edn does not support auto-resolved keywords at all
::
keywords are not part of edn
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)
generally, I find it best with edn data on disk to just use fully-qualified keywords
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?
ok, that definitely isn't obvious to me 🙂
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
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])))
(pr-str
(Record.
(Hex. (into-array Byte/TYPE [0]))))])
; actual -> ["#hex[00]" "#record[filter_db.core.Hex@85514e1d]"]
; 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.
@seancorfield it just worked
thank you 😃