Fork me on GitHub
Pavel Shatyor09:12:43

Hi everyone! 😉 Folks, Node Congress has CFP open. Please submit if have something to say. CFP is open until January 10 Join here —

Kari Marttila13:12:50

Is the most used statistics library for Clojure nowadays?


Don't think so


Hum, actually it does seem popular. This one is as well:


Can't say which one is most popular though. I'd say both are production ready if that's what you're worried about


I think the difference is fastmath uses Java implementations under the hood, while kick.stat is fully implemented in Clojure using transducers.

Otis van Duijnen Montijn15:12:56

I am trying to figure out what states a certain state of a state machine can transition to. I am now dealing with data that looks like this:

{:com.fulcrologic.fulcro.ui-state-machines/handler #unknown function (env)
 {return com.fulcrologic.fulcro.ui_state_machines.activate
  (env, new cljs.core.Keyword ("state", "button1", "state/button1", 936328262))}}
I need to extract the "state/button1" from this data. Does anyone have tips on how to do that?


it seems you are dealing with an opaque function object and not data?

Otis van Duijnen Montijn15:12:10

Do you know of any documentation on this I can use?


documentation on what exactly?

Otis van Duijnen Montijn16:12:45

I think I get what you meant now. Thanks for this. I probably need to call the function to figure out the return value


it looks a bit like javascript?? if you have a javascript function, you can call .toString on it to get it's source and parse that string? is that what you mean?


What is the idiomatic way these days to implement a CLI in a project? I'm new to deps.edn - does it allow specifying a default main namespace, like the equivalent of :main in project.clj? I'm envisioning that a user could git-clone the repo and invoke some minimal clojure command to pass control to main method of intended namespace (which actually implements the CLI using tools.cli and provides usage info when invoked with no args, as per usual).


Thanks. I'm still working my way through all that documentation. So in my example a user would have to know to invoke

clojure -M -m cli
at a minimum. My question is, can the cli namespace somehow be specified in deps.edn? Is there some even more minimal clojure command like
clojure -M
or like a way to have project specific usage resulting from clojure -?. Or is it just not designed|intended for that?


I suppose it's a moot question, once the project were packaged up as a proper release, presumably a jar file with a start script.


in an alias: :main-opts ["-m" "my.ns.with.main" "arg1" "arg2"]


then: clj -M:thealias


@U07PUGBA6 If your CLI only uses clojure.core and tools.cli and some other commonly used libs, you could also consider babashka, since that is built with this usage in mind.

👍 3

Another option (for regular JVM Clojure) is just writing a script which you can invoke directly, not with a main. Like here:


But typically (with deps.edn) you would write an alias with pre-defined main args like explained above.


Thanks to you both, this is very helpful and exactly what I was wondering about: how is this typically done.


I guess it depends who the user you are targeting is


If a Clojure dev, then use an alias. Then they don't even need to git clone or anything


They just add the alias to their deps.edn user config, and now they can use it

👍 3

I've also built a CLI with (features on top of tools.cli ) and I had a good experience.

👀 3

docopt is also an option: (also works in babashka as a lib)

👀 3
✔️ 3

depending on how simple your tool is, you may not even bother with aliases or a deps.edn at all


for example doesn't have a deps.edn at all, and the README just lists a bunch of different clj -X ... invocations

👍 3

This template adapted for IDEA. Use make for control.