Fork me on GitHub
#clojure
<
2019-04-03
>
hadils01:04:19

Hi. How can i use com.cognitect.aws/email to use email on AWS?

Alex Miller (Clojure team)01:04:05

#aws is a good place to ask this

sundbp12:04:40

Hi. I'm trying to use compile with a gen-class. I get a class not found exception when the constructor is defined taking a class from a lib I'm using. I can import that same class, and changing the type to eg String makes compile work. Any caveat about types for constructor args and class path etc?

sundbp12:04:45

Hm. This was with tools.deps - if I instead try with lein all is well.

helios12:04:39

there's also the channel #tools-deps where you might have more luck than here 😄

sundbp12:04:31

Yep, realized this after testing it with lein.

ok13:04:25

what would be closest and cleanest way to have "cron jobs" in Clojure. Something to run every some time from within web app. Like @Scheduled in Java Spring...

benoit13:04:53

@twaima Java's ScheduledExecutorService works well but you can also write something custom with a core async go loop and timeout

joelsanchez13:04:01

quartz via clojurewerkz/quartzite is quite popular

👍 8
orestis14:04:48

There’s also juxt/tick

Lennart Buit14:04:29

and chime and at-at

orestis14:04:22

Someone should write a comparison for those!

lilactown14:04:23

I've used tick before and found it worked well 👍

Lennart Buit14:04:50

yeah, the scheduling part of tick is deprecated tho 😞

orestis16:04:22

Oh. Good to know. They advocate using tick over quartz in the readme...

dominicm16:04:52

Plan is to undeprecate later

Jakub Holý (HolyJak)15:04:08

Is there a better way to split a list of pairs into lists of the firsts and seconds than [(map first pairs) (map second pairs)] ? Thank you!

kwladyka16:04:15

(map (juxt first second) [[1 2 3] [4 5 6] [7 8 9]])

kwladyka16:04:23

or (map (partial take 2) [[1 2 3] [4 5 6] [7 8 9]])

kwladyka16:04:49

ah no, sorry you want it to have in different way

Jakub Holý (HolyJak)16:04:51

thx but I want the opposite: ([1 2] [4 5] [7 8]) -> ([1 4 7] [2 5 8])

Scott McCaughie08:04:14

since map takes multiple collections, you can do:

(->> [[1 2] [4 5] [7 8]]
     (apply map vector))
=> ([1 4 7] [2 5 8])

Jakub Holý (HolyJak)15:04:51

Nice! But it will break if there are too many elements, map isn't defined for any number of args

Scott McCaughie15:04:01

I don’t see that limitation… just ran it for a vector of 50000 pairs without issue… (apply map vector (partition-all 2 (range 100000)))

Scott McCaughie15:04:22

am I misunderstanding what you mean by too many elements?

Jakub Holý (HolyJak)17:04:48

Does map take up to 50k arguments or am I missing something? Or does apply do something else than (map fn pair1... pair50000)?

Jakub Holý (HolyJak)18:04:21

Ah I see https://stackoverflow.com/questions/2735600/why-is-there-a-limit-of-max-20-parameters-to-a-clojure-function > First of all, the limit only applies to required positional arguments; you can always use the variable arity case (& more-args in the function's signature) to handle as many arguments as you want to Thanks, today I learned 2 useful things!

jvtrigueros15:04:21

I've used quartzite before, while it works great, it's a bit heavy with some learning curve as you kind of need to know how Quartz works.

eraserhd16:04:38

Is there a stateful transducer like "reductions"?

eraserhd21:04:25

ah! thanks!

lilactown16:04:44

i'm trying to bundle a Clojure desktop app to be executed stand-alone on macOS & Windows. anyone know of some resources on how best to do that with JDK 11?

lilactown16:04:08

I want to supply my own JRE with the app

lilactown16:04:23

I tried packr but I can't figure out how to use it with JDK 11 yet

metametadata16:04:01

I used javapackager for this (a long time ago though so not sure about JDK 11)

sotrhraven16:04:40

Is "Clojure Programming: Practical Lisp for the Java World" still a relevant book to learn clojure?

lilactown16:04:04

it looks like javapackager was removed from JDK 11 😕

lilactown16:04:05

hm. looks like I might be able to use a backported version

lilactown16:04:12

that's being worked on for JDK 13

devn17:04:16

i seem to recall a new-ish clojure lib for building UIs (not seesaw)

devn17:04:19

anyone know the name of it?

devn17:04:40

that's the one, thanks

lilactown17:04:27

yeah. just got done creating a simple app; seems good, still don't understand a lot

lilactown17:04:46

now I'm trying to figure it out how to distribute it to my coworkers who might not have JDK 11 😬

lread20:04:39

My little hobby app was macOS only. FWIW I used https://github.com/Jorl17/jar2app along with JavaAppLauncher built from https://bitbucket.org/infinitekind/appbundler/

vlaaad17:04:05

@devn join #cljfx 😺

mbjarland19:04:50

High level noob question: would using datomic ions for a normal page serving ring app (i.e. not an api or event triggered code etc) be a bad fit for some reason?

devth20:04:06

has anyone encountered any sort of linting / analysis tools that could detect whether a change on a clj codebase maintains some notion of backward compatibility?

dominicm20:04:56

I think that's Rich Hickey's research project, when I asked a while ago, I was told it's not close to fruition yet.

devth20:04:44

will be very interested to see what he comes up with 🙂 coincidentally, this question came up after thinking about the spec-ulation talk

devth20:04:55

and thinking about how i want to do versioning in my clj projects

devn23:04:04

anyone know who runs the logging? seems broken

dpsutton23:04:48

from a while ago. possible you could reach out to @plexus

seancorfield23:04:56

@devn Most channels here are mirrored into Zulip via @zulip-mirror-bot (which you can invite to any channel it isn't already a member of). https://clojurians.zulipchat.com/#narrow/stream/180378-slack-archive

devn23:04:31

other question for ya: I remember alex miller saying something about some interesting business required to get constant-time dispatch in case. I've been reading over it, but wondered if anyone here knew the details well enough to give their take on what's going on here. the deeper i dig, the more questions i have

devn23:04:22

max-switch-table-size, case-map, prep-ints, prep-hashes, max-mask-bits, maybe-min-hash, etc. etc.

devn23:04:27

curious about why case-map builds a sorted-map, where the value for max-mask-bits comes from

devn23:04:36

and other curious bits

noisesmith23:04:40

so as I understand it the big picture is constructing a lookup table out of your case call at compile time (you probably know that part already)

devn23:04:18

yeah, i might be misremembering, but i feel like there was some relation to the bytecode that's emitted maybe?

noisesmith23:04:51

right, case is a special form, that means it takes your form as input, and produces byte code as output

noisesmith23:04:44

and the job with case is to turn the whole call into one table lookup (which is why all dispatch must be compile time literals - you can't calculate the dispatch correctly otherwise)

noisesmith23:04:18

the rest of what you find there is implementation of that concept (as I understand it)

devn23:04:22

err, is case a special? i didn't think it was

devn23:04:29

it's a macro

noisesmith23:04:48

oh, right, case* is the special

devn23:04:21

ahhhh, ok, i missed that earmuff

noisesmith23:04:55

yeah, I elided that distinction above as well

noisesmith23:04:47

so the case macro does a bunch of prep work with the input form, and produces data that's tied to the implementation details of the case* special form (bit-mask, hash implementations ...)