This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-11
Channels
- # adventofcode (42)
- # asami (13)
- # babashka (40)
- # beginners (25)
- # calva (39)
- # cider (18)
- # circleci (6)
- # cljs-dev (3)
- # clojure (39)
- # clojure-europe (16)
- # clojure-norway (9)
- # clojure-uk (2)
- # clojurescript (42)
- # datalevin (4)
- # datomic (23)
- # fulcro (33)
- # jobs (1)
- # malli (26)
- # minecraft (1)
- # off-topic (88)
- # pedestal (3)
- # polylith (8)
- # re-frame (6)
- # remote-jobs (2)
- # shadow-cljs (20)
- # tools-deps (12)
- # xtdb (5)
Do you a graphic (see picture) would improve the https://clojure.org/reference/refs on clojure ref? I find it very hard to read linear text and imagine time. When time becomes another variable on a graph, its easier. In fact, likely calling time something else in explaining a concept the first time would help ease the mind.
mostly unrelated question, what would be the use of a dosync block without a ref being referenced in it? https://clojure.github.io/clojure/clojure.core-api.html#clojure.core/dosync oddly makes no mention of refs in its docs, only of "transactions" but where else can you store transaction outcomes beyond a ref?
I think the only thing i could suggest is that in the docs "Ref" be a blue link to draw attention to my overloaded mind. Cider-docs on emacs does this luckely.
err. I'll be struggling to just understand the ideas well enough to draw them on paper for one or two examples. off to bed with me.
If you haven't seen https://youtu.be/E4RarTAZ2AY it includes rhickey talking about clojure's model of time
Looks like a sequence diagram.
Yeah, a message sequence chart, just with the timelines running horizontal instead of vertical
@U3T9E4R0A those drawings are from here martin kleepmans work. I believe he draws them himself.
@U0NCTKEV8 ill watch it tomorrow ty.
> I believe he draws them himself.
Actually I think the confluent folks use something called "paper" "concepts"
https://rmoff.net/2019/07/11/so-how-do-you-make-those-cool-diagrams-july-2019-update/
While setting up a project with next-jdbc
there is a lot of effort to convert from underscore to kebab. Well, additional work at least. Question do you find value in having kebab vs underscore, or its just a visual preference? (Followin general intuitions that less stuff like converting than better)
IMO kebab is more convenient and readable. It's also friendlier to my pinky. If I can set some conversion up at the edges I prefer it
Thanks for info. By at edges you mean _explicit_ in code? (btw for your pinky, why not use left shift for _ ? sorry, im into keyboards and it seems really unergonomic to press right shift + -) :slightly_smiling_face:
I'd say implicit. Best case scenario - you never see snake-case at all when working with e.g. DB. Or anywhere.
And I do use left shift for _
- it's still noticeably more cumbersome than just -
. Especially when you have to type it 3 times in a single identifier.
Both shifts are inconvenient for me, but by the edges I mean implicit (or once explicit) and handled when you set up the interface with the edge. For example with next-jdbc you can pass a row builder which handles all that for you
Were there any guides on how to investigate / reproduce the latest log4j CVE in your own Clojure app? https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44228 Also, are there any guides for friends and family?
More specifically – is there an easy way to understand what logging backend was chosen by clojure.tools.logging? For those who didn’t set it explicitly
Examine your dependencies @iw.romanof579
A place to start, thanks! Not sure if it guarantees anything though 🙂
@U050ECB92 found it!
(.name clojure.tools.logging/*logger-factory*) ;; get your current logging implementation name
It can change when adding new dependencies. It just looks for classes in a certain order and the first found is your logger.
(do
(do
(clojure.core/defprotocol
PApple
(color
[this__10047__auto__]
[this__10047__auto__ new-value__10048__auto__])
(size
[this__10047__auto__]
[this__10047__auto__ new-value__10048__auto__])
(shape
[this__10047__auto__]
[this__10047__auto__ new-value__10048__auto__]
"The shape of the apple"))
(clojure.core/defn
apple?
[o__10049__auto__]
(clojure.core/satisfies? PApple o__10049__auto__)))
(clojure.core/defrecord
Apple
[color size shape]
PApple
(color [this__10070__auto__] color)
(color
[this__10071__auto__ new-value__10072__auto__]
(clojure.core/assoc
this__10071__auto__
:color
new-value__10072__auto__))
(size [this__10070__auto__] size)
(size
[this__10071__auto__ new-value__10072__auto__]
(clojure.core/assoc
this__10071__auto__
:size
new-value__10072__auto__))
(shape [this__10070__auto__] shape)
(shape
[this__10071__auto__ new-value__10072__auto__]
(clojure.core/assoc
this__10071__auto__
:shape
new-value__10072__auto__)))
(clojure.core/defn
apple
[args__10095__auto__]
(clojure.core/when-let
[error-info__10093__auto__
(clojure.core/some->
(malli.core/explain [:map [:size pos-int?]] args__10094__auto__)
(malli.error/humanize))]
(throw
(clojure.core/ex-info
(clojure.core/str error-info__10093__auto__)
error-info__10093__auto__)))
(map->Apple args__10095__auto__)))
; Syntax error (ClassFormatError) compiling deftype* at (src/dev/mccue/demo.clj:135:1).
; Duplicate method name "size" with signature "()Ljava.lang.Object;" in class file dev/mccue/demo/Apple
If i comment out the single arity size
i get
(clojure.core/defrecord
Apple
[color size shape]
PApple
(color [this__10070__auto__] color)
(color
[this__10071__auto__ new-value__10072__auto__]
(clojure.core/assoc
this__10071__auto__
:color
new-value__10072__auto__))
#_(size [this__10070__auto__] size)
(size
[this__10071__auto__ new-value__10072__auto__]
(clojure.core/assoc
this__10071__auto__
:size
new-value__10072__auto__))
(shape [this__10070__auto__] shape)
(shape
[this__10071__auto__ new-value__10072__auto__]
(clojure.core/assoc
this__10071__auto__
:shape
new-value__10072__auto__)))
; Syntax error (VerifyError) compiling new at (.calva/output-window/output.calva-repl:198:1).
; Bad type on operand stack
Exception Details:
Location:
dev/mccue/demo/Apple.size()I @6: ireturn
Reason:
Type 'java/lang/Object' (current frame, stack[0]) is not assignable to integer
Current Frame:
bci: @6
flags: { }
locals: { 'dev/mccue/demo/Apple' }
stack: { 'java/lang/Object' }
Bytecode:
0000000: 2ab9 018f 0100 ac
ignore me - running into that wierd thing where defrecords are also maps and thus have a .size
hey, i'm trying something odd, feel like macro territory?
(let [args [1 2 3]]
(-> []
(conj 1)
(conj 2)
(conj 3)
;conj by adding individually, sort of like in loop)
not sure if your usecase is as simple as your demonstration here, but (conj [] 1 2 3 4)
. And even if it is more complicated, I don't see any reason to reach for a macro when you could use functions
conj is used more or less as example, I am aware I can pass multiple params, or even use something like (apply conj args)
, its more about programatic composition inside threading macro, to give different example
(let [fns [f1 f2 f3]]
(-> _
(f1...
(f2...
it's not really clear why apply
doesn't apply here. another alternative is:
(reduce #(%2 %1) initial-value [f1 f2 f3)
eg:
> (reduce #(%2 %1) 0 [inc inc inc dec inc])
3