Fork me on GitHub
#clojure
<
2020-09-30
>
Aron08:09:30

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

p-himik09:09:04

FWIW I use it.

Aron09:09:44

that's widespread enough, thanks 🙂

😆 3
nickt13:09:56

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

nickt13:09:59

or anything similar?

restenb13:09:25

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

nickt13:09:36

ah! Yes, thank you

scythx13:09:39

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.

Ertugrul Cetin14:09:09

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

❤️ 3
emccue23:09:08

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

❤️ 3
manutter5113:09:52

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

9
scythx13:09:03

Thank you!

hanDerPeder19:09:43

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

hanDerPeder19:09:25

ah, logging.readable

Jeff Evans19:09:31

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

Toyam Cox19:09:45

Depends on how you escape-quote

Jeff Evans19:09:58

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?

kennytilton20:09:49

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

Jeff Evans20:09:49

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

Jeff Evans20:09:34

like if you have something along these lines:

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

Jeff Evans20:09:59

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

Jeff Evans20:09:31

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

Jan K21:09:30

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

Jeff Evans21:09:23

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

kennytilton22:09:26

@U0183EZCD0D “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.

Jeff Evans22:09:25

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

Jeff Evans22:09:52

as in, errors even during macroexpand

Audy23:09:55

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

emccue23:09:58

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

emccue23:09:18

it is in RuntimeMXBean

emccue23:09:04

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

emccue23:09:49

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

😂 3
Audy23:09:08

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

emccue23:09:43

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

Audy00:10:29

I see. I’m fairly new to clojure. So I don’t know too much on the java ‘libraries’… Do I need to require a certain namespace to use ManagementFactory?

emccue00:10:28

you need to import the class

emccue00:10:20

are you running in a repl or do you have a file with a ns at the top?

Audy00:10:14

ns at the top

emccue00:10:47

(ns whatever
  (:require [] ...)
  (:import (java.lang.management ManagementFactory)))

Audy00:10:01

damn didn’t know you can do that! I guess thats one of the beauties of Clojure. So whatever is in the Oracle docs thats java, I can import and use that?

Audy00:10:06

I really appreciate your help tonight! I can move forward and run with this!

emccue00:10:03

yeah, all of clojure maps to the "java metaphysics" in some way

emccue00:10:14

and you can import and use any classes you want

emccue00:10:52

though certain things will be easier than others - "spring-like" stuff with annotations or stuff that reflectively calls constructors can be a pain

Audy00:10:50

I’ve just been using the core library, and its all that I’ve needed so far. But now its a whole new world! lol

Malik Kennedy23:09:42

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