Fork me on GitHub
#clojure
<
2018-10-23
>
abdullahibra09:10:56

is there a tool for reformatting clojure code from cmdline ?

andy.fingerhut09:10:13

Looks like this project can do it without Leiningen or a JVM installed, using Node.js, in case that is of interest: https://github.com/snoe/node-cljfmt/

tristefigure09:10:34

Depending on what you do, you might also be interested in rewrite-clj which preserves the textual aspect of code (indentation, comments, reader-macros ...) but presents it in the form of an AST (or should I say Concrete Syntax Tree ?). https://github.com/xsc/rewrite-clj

Sushan10:10:23

We have designed the 2 services in which one uses def and other mount/defstate to connect with mongo DB. Both are working good Can we get suggestion on which approach is better and downside of other?

lukas.rychtecky10:10:21

I’m not experienced in mount, but it’s better to have stateless code (components) and let a framework to “inject” stateful objects into your stateless components. That’s how https://github.com/duct-framework/duct works

schmee11:10:02

“better” citation needed

schmee11:10:26

some advantages of defstate compared to def: - you can override dependencies for tests - you can load all namespaces without having a database up since connection happens on mount/start instead of namespace load - you can grep for defstate to find external dependencies

schmee11:10:56

have a look at alternatives like component, integrant and commix (super obscure but my favorite 😄), compare them and see which one you prefer

lukas.rychtecky11:10:01

@U3L6TFEJF “better” => stateless code, less place for errors and as you said “you can load all namespaces without having a database up”

schmee11:10:50

oh, I think I misread your sentence as “I’m not experienced in mount, but these other things, like duct, are better”. reading it back I see you were not arguing against mount, my bad 🙂

lukas.rychtecky11:10:13

That’s OK 😉

lukas.rychtecky11:10:51

I work with both and I can say they overlap.

noisesmith16:10:41

if you create a mongodb connection inside def, and use gen-class or aot, the build process fails if it can't connect to mongo

noisesmith16:10:34

clojure doesn't have a "compile mode" where side effects inside forms are not run - top level side effects are always run by clojure

roklenarcic12:10:03

I'd like to find out at runtime if a certain namespace can be loaded. find-ns only works off namespaces that are already loaded. What's the best way to do this?

roklenarcic13:10:31

Yes, that finds namespaces in a directory, but I'd like to find to find namespace wherever it is in classpath

roklenarcic13:10:48

I don't know what classpath the app was ran with

cklaou13:10:03

Hello people, this is my Base64 codec pet project. I also went on building a native image with GraalVM which seems to work nicely, although not very much tested. Only concern is that I don't see that big speedup (only about 2x) in some cases. Any feedback/tips appreciated https://github.com/Sorrop/base64clj

quadron13:10:41

i'm having trouble organizing my code. how are separate components of the system supposed to communicate? does it make sense to assign each logical component of the system a URL and have them send letters (with sender-receiver URLs) to a "post-service"? if so how is that URL thing to be constructed? do I conceive of namespaces as URLs? or should I write a dynamic registry for running processes? are there any libs/examples that might shed some light on this matter?

quadron14:10:55

it doesn't seem right to geometrically connect components

dangercoder18:10:14

Anyone who can recommend a polling-lib? Currently Investigating a good way of creating a method which I can call upon when I need to run a certain function every XXX ms. It also needs to be able to stop after a certain condition is met (I.E I get a certain status back from an api call.. database w/e)

noisesmith18:10:39

if I made one I would name it are-we-there-yet

dangercoder18:10:08

haha maybe that is what I should name it 😉 if I don't find anything to use

jaide19:10:36

Would this be a good use case for core.async?

Dormo21:10:29

Immutant has a scheduling library with cron-like functionality

Dormo21:10:51

There's an #immutant channel here with the maintainers, though it's pretty quiet

dangercoder05:10:22

looks nice. im gonna try it out

dangercoder05:10:51

quartz is not what i need right now, I need to be able to initiate a polling-job from another function call and I need to define the "Job(a function that does something)" on the fly.

noisesmith18:10:04

@jarvinenemil regarding your actual question, I ended up using ScheduledThreadPoolExecutor directly in the past when the task was specific to one server, then updating to Quartzite when it needed to run on a cluster basis

dangercoder18:10:01

I'll check it out, thanks @noisesmith and @jeff.terrell for the advices ✌️

noisesmith18:10:24

at-at is a thin wrapper on ScheduledThreadPoolExecutor fwiw

noisesmith18:10:54

oh - not as thin today as it was when I last checked

parrot 4