Fork me on GitHub

(if (seq cols) (apply map + cols) <whatever other value you want>)


Or throw an exception perhaps if it “shouldn’t happen”.


Okay! Thank you! 😄


If you want an exception and you don’t care about getting a lazy seq of sums, you could just (apply mapv + cols) — it will throw an arity error if cols is empty.


Also by any chance do you have example projects using ? Am trying to use it but another reference might help


I don’t know what will be more useful than the examples in the README but clj-new still uses it (even though the old -m command-line is no longer documented). See for the opts definitions and for the point of use.


(although that uses :assoc-fn in places where I’d use :update-fn now)


See this example from tools.cli’s README for what I mean about that:

["-f" "--file NAME" "File names to read"
    :multi true ; use :update-fn to combine multiple instance of -f/--file
    :default []
    ;; with :multi true, the :update-fn is passed both the existing parsed
    ;; value(s) and the new parsed value from each option
    :update-fn conj]


Hi, I'm trying to apply the bean function over but I'm getting this error:

(bean ( ""))
Error printing return value (ConnectException) at (
Connection refused (Connection refused)
Anyone can say why this is happening?


(bean (.URL. "")) shows it has :content on it. If you look at the error thrown by your function you'll see [ getContent "" 1177] in it. And you presumably don't have a webserver running locally on port 80


hmmmm, thank you @dpsutton


(slurp (.getContent (.URL. ""))) is the contents of the resource


Yes, the bean function walks over every getter and returns a map.


This is why I'm getting this error. Thank you again @dpsutton


I think i'm generally just a bit confused about how to package my project into a binary (?) or rather I need to read up more cause I have been pretty much only been using lein run


@seancorfield I think me asking this would help. Is

my-program -vvvp8080 foo --help --invalid-opt
the equivalent of running the following in the repl ?
(-main "-vvvp8080 foo --help --invalid-opt")


This is from the quickstart example. I've been particularly confused about how to get that working


They should be separate strings.


(-main "-vvvp8080" "foo" "--help" "--invalid-opt")


-main expects to be called with a sequence of zero or more strings


Right right :face_palm: i recall a similar confusion I had when working with


Thank you!

Rob Haisfield01:05:42

Just describing my dog in Clojure. Not totally sure if I’m doing this right lol. One area is I want to also describe his reaction to the :triggers but not sure what to do there


@rob370 seems fine ? Are you perhaps thinking of the triggers being functions?


Is there a way to print out a table when you do lein run ? I know there is clojure.pprint/print-table but is there a direct that to cli output?


nvm I just realised it is because I was getting a clojure not found error from not requiring the namespace


How do I compile a leiningen project? Like I can do lein run to use my program. And I understand I can do lein uberjar but have a feeling that's not what I want exactly?


What do you want?


I think I want a simple way to allow someone to package my repo and run it as an executable. I think comes close


Oh i think I can just include it in my project.clj hmm


It depends on your audience then, I usually take an uberjar to mean that, but if your audience is less technical then you will need something additional like that lein plugin


How do you run an uberjar actually?


java -jar uberjar.jar


That depends too


You can build jar files that launch like that


But java only knows how to run jvm bytecode, so you either have to hand it jvm bytecode (by aot compiling clojure) or bootstrap (run some bytecode that knows how to load clojure)


Hmmmm, will have to dig deeper into that but lein bin works well for now java -jar worked too for the standalone.jar that was produced

Sivaram Konanki10:05:04

what is the meaning of :* in Clojure?


it is a normal keyword, nothing special about it

👍 1
replied to a thread:

There is great value in running tests via the REPL and externally via the command line (possibly by a watcher). I run selective tests (specific namespace, individual deftest) predominantly in the REPL during development and run all tests (including integration tests) via the command line before pushing commits (or if I get unexpected errors or longer running test suite) I run tests within the REPL using a connected editor. This avoids context switching to an external tool, although does require changes to be evaluated before they can be tested. You must manually ensure the REPL is in sync with the saved source code before committing changes. I use Kaocha test runner to run tests via the command line, which always tests code saved to disk, so uses a clearly defined state. This clearly defined state is especially valuable for integration tests. The CLI approach is also more robust for longer running tests than running within an editor. Running tests on the should be able to emulate the test step of a CI/CD service, providing a means to debug issues with such a service.