Fork me on GitHub

is there a tool for reformatting clojure code from cmdline ?


Looks like this project can do it without Leiningen or a JVM installed, using Node.js, in case that is of interest:


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 ?).


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?


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 works


“better” citation needed


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


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


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


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 🙂


That’s OK 😉


I work with both and I can say they overlap.


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


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


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?


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


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


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


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?


it doesn't seem right to geometrically connect components


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)


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


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

Eccentric J19:10:36

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


Immutant has a scheduling library with cron-like functionality


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


looks nice. im gonna try it out


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.


@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


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


at-at is a thin wrapper on ScheduledThreadPoolExecutor fwiw


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

parrot 4