clojure

New to Clojure? Try the #beginners channel. Official docs: https://clojure.org/ Searchable message archives: https://clojurians-log.clojureverse.org/
Aron 2020-09-30T08:02:30.341100Z

how widespread is the usage of the transit-python package?

p-himik 2020-09-30T09:21:04.342700Z

FWIW I use it.

Aron 2020-09-30T09:43:44.343100Z

that's widespread enough, thanks 🙂

😆 1
nickt 2020-09-30T13:00:56.344400Z

hey folks, is there an all construct in clojure? For determing whether all entries in a list are true?

nickt 2020-09-30T13:00:59.344600Z

or anything similar?

restenb 2020-09-30T13:01:25.345Z

@nickt (every? true? list-of-bools) ?

nickt 2020-09-30T13:02:36.345500Z

ah! Yes, thank you

scythx 2020-09-30T13:21:39.348100Z

Hello, does anybody know decent library to create UI in clojure? quick google got me fn-fx, is it good enough? I really want to use clojure for my school assignment, but i don't want to risk to try something buggy.

tvaughan 2020-10-01T11:20:20.369100Z

https://github.com/cljfx/cljfx see also #cljfx

❤️ 1
2020-09-30T13:25:52.348500Z

You might want to check out cljfx and the #cljfx channel

➕ 3
scythx 2020-09-30T13:27:03.348700Z

Thank you!

2020-09-30T13:31:32.348800Z

https://github.com/daveray/seesaw

❤️ 1
ertugrulcetin 2020-09-30T14:50:09.349600Z

Addition to @markbastian, if you want React like virtual dom functionality you could check fork of seesaw (I wrote); https://github.com/ertugrulcetin/seesaw

❤️ 1
hanDerPeder 2020-09-30T19:10:43.352800Z

can I log readable data with clojure.tools.logging like I can with pedestal.log ?

hanDerPeder 2020-09-30T19:12:25.353Z

ah, logging.readable

2020-09-30T19:23:31.353700Z

when a macro definition calls a fn, are the arguments evaluated?

Toyam Cox 2020-09-30T19:38:45.353800Z

Depends on how you escape-quote

2020-09-30T19:48:58.354Z

right, so, if it’s inside a syntax quoted section (i.e. backtick), then it ends up as part of the expansion (not evaluated), so it seems fairly obvious that in that case the fn is not even called at definition time, right?

kennytilton 2020-09-30T20:54:49.354700Z

Correct. Only unquoted (~) forms are evaluated at macroexpansion time. Now when we get into nested quoting/unquoting… :)

2020-09-30T20:55:49.354900Z

not only unquoted, but also forms appearing before the first backtick, right?

2020-09-30T20:56:34.355100Z

like if you have something along these lines:

(defmacro something [& rest]
  (let [foo (my-fn (first rest))]
    ...

2020-09-30T20:56:59.355300Z

then my-fn is invoked with the first item from the macro arg list, which is an unevaluated symbol, I believe

2020-09-30T20:57:31.355500Z

so the real question is, does my-fn receive it as an unevaluated symbol as well? or does it evaluate?

Jan K 2020-09-30T21:17:30.355700Z

It can't evaluate, that code happens at macroexpansion time, my-fn receives unevaluated form or symbol or literal, whatever was passed in.

2020-09-30T21:21:23.356Z

thank you! when you put it that way, it makes perfect sense

kennytilton 2020-09-30T22:06:26.357200Z

@jeffrey.wayne.evans “not only unquoted, but also forms appearing before the first backtick” Absolutely, and a fun homoiconic trick is to add debug print statements in such code to see what is going on, especially with more elaborate/destructured macro params. Nice learning aid as I was getting up to speed on macrology.

2020-09-30T22:10:25.357500Z

yeah I have definitely made use of that. glad to hear there isn’t an obvious better way to debug macros 😂

2020-09-30T22:10:52.357700Z

as in, errors even during macroexpand

2020-09-30T23:26:55.358200Z

Is there an idiomatic way to get the time of how long my program has been active/running?

Malik Kennedy 2020-09-30T23:29:42.359Z

(time ...) macro for small parts ?flame-graphs? for larger parts? (I havent used flame-graphs myself)

emccue 2020-09-30T23:37:08.359100Z

I've used seesaw for a school assignment. cljfx is the way to go for "real" or "good" apps, but seesaw has a better chance of running on a random JVM

❤️ 1
emccue 2020-09-30T23:37:58.359300Z

Yes! in fact, I know this for some insane reasons

emccue 2020-09-30T23:38:18.359700Z

it is in RuntimeMXBean

emccue 2020-09-30T23:40:04.359900Z

(-> (ManagementFactory/getRuntimeMXBean)
    (.getUptime)
    (Duration/ofMillis))

emccue 2020-09-30T23:41:49.360100Z

and before you ask I have no clue what an MXBean is

😂 1
2020-09-30T23:44:08.360400Z

Thanks I’ll mess around with this. This looks like what I was trying to achieve, the uptime of the current runtime!

emccue 2020-09-30T23:47:43.360600Z

Yeah the "idiomatic" part is just dealing with Duration objects instead of the long for any logic