Fork me on GitHub

Is there a way to get prn and its ilk to print meta definitions? eg. how to get the following to include the meta data in its output?

> (prn-str '(def ^{:dynamic true} *foo* 10))
"(def *foo* 10)\n"


There’s a dynamic var for this. (apropos “meta”) should reveal it


user=> (binding [*print-meta* true] (prn (with-meta {:a 1} {:b 2})))
^{:b 2} {:a 1}

😍 3

Thanks. I’m on mobile so didn’t know the exact var. also I think apropos and find-doc are criminally under discussed so like to mention them

☝️ 3
💯 2

(I didn't know about that until you mentioned it!)


And, yes, I used (apropos "meta") to find it.


A queryable runtime is very close to a hard requirement for all future programming languages I use

🙌 9

Any standard way to run leiningen in the background yet? Or otherwise to watch clj and cljs builds in the same shell?


lein doesn't support backgrounding and I don't think it ever will, as a compromise you could try tmux for switching between sessions in one terminal window


@alexmiller @hiredman Getting closer to the weird offset issue with GraalVM: Direct linking seems to affect it in that particular case.


The problematic function that trips up native-image with direct linked Clojure compilation is defined here: Perhaps this non-standard way is causing issues


Perhaps the eval is called again during native image compilation yielding a different copies of those functions wheres with defmacro you don't have this problem?

👍 3
Karol Wójcik10:05:17

Per request of @U04V15CAJ I've tried to patch the library to use macro. Issue no longer exists:


(require '[clojure.template])
(macroexpand '(clojure.template/do-template [] (def a b) x 1))


I guess the 💥 result is to be expected: > values are automatically partitioned by the number of arguments in argv (partition 0 [1]) will explode in just the same way.


Hey all, got a question - I am trying to flatten maps, so that map that looks like {:a {:b 2 :d 3}} would become:

((:a :b 2)(:a :d 3))


Ok, I think I can work this out... something like that:

(defn flatten-data2 [m key]
  (if (map? m)
    (for [[k v] m] (flatten-data2 v (conj key k)))
    (conj key m)))


hello, any idea how to fix the following error Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch proc file - > web: java -cp phs.jar clojure.main -m phs.system


That sounds like a #heroku question @spamails29?


Sounds like your app is just taking too long to start up. How exactly are you building phs.jar? Maybe AOT will make it start up faster…


same error with aot. added extra line to the existing edn file :depstar {:extra-deps {seancorfield/depstar {:mvn/version "1.0.94"}}}


since it is giving error while deploying


Adding an old version of depstar is not the solution to your problem — the repo is already using the more recent version. What is the error you are seeing during deployment?


remote:    Running: bin/build remote:    Error building classpath. Specified aliases are undeclared: [:depstar]


bin/build file #!/usr/bin/env bash clojure -A:depstar -m hf.depstar.uberjar pingcrm.jar


I said to use clojure -X:uberjar — that’s what the deps.edn in that project is expecting.


Again, using the alias you added and just that command you added will not AOT the JAR file.


The command I suggested — and the alias that is already in the project will AOT the JAR file.


tried looks like heroku is rejecting it


remote:    Exception in thread "main" -X:uberjar (No such file or directory)


The version of clojure is too old on Heroku I guess?


You would need to use at the very oldest but preferably whatever is the latest version Heroku supports.


If you don’t want to try overriding the CLI version per that link and you want to continue to try to use depstar 1.0.94, you should read the docs for that version so you can see how to AOT the JAR:

clojure -A:depstar -m hf.depstar.uberjar pingcrm.jar -C -m pingcrm.system
from (the older version of the readme) That should produce a pingcrm.jar that can be run with just java -jar — although I suspect that old version might still require a pom.xml file for building an uberjar (which isn’t needed with the newer version).


thanks.updated the cli, build error resolved. heroku not launching the app. will try with aws


thanks for the help, looks like their was issue with the system file


On Heroku, you can increase boot time out to 180 seconds. Had to do it - too many issues with AOT that were way too hard to solve. YMMV of course.


increased it to 180 same error


I would try profiling the start-up time and see if there's something suspicious going on apart from just the compilation.


Jason has gone to DM with me about it, but for Heroku details, I’m recommending he ask in #heroku (since I don’t use Heroku at all).


What’s the fun of using add-tap and tap>? Can someone give an example use case?


One use case is to replace println in development. Instead of strings in the console, you get data and you can extend how tapped values are handled depending on the context


I use Reveal as a tap> “client” to display every tap>’d value, either as a table, or in some other useful form. And as Adrian says, you can add tap> calls wherever you want for debugging (and leave them in the code if you want — since they do “nothing” if there are no clients added). You can have multiple clients attached via add-tap so you can have one client showing plain text output and another client showing graphs for vectors of numbers, for example. You can remove-tap to take a client away once you’re done with it.

reveal 6

Tools like Cognitect’s REBL, Reveal (linked above), and Portal from @djblue are great additions to a REPL-based development workflow and all act as tap> clients.

Rob Haisfield21:05:37

Any great writing or videos besides the documentation on how to really utilize IntelliJ + Cursive? I feel like I’m using 2% of its capabilities


There is a #cursive channel where the target audience might be more likely to know an answer to this.

Rob Haisfield01:05:16

Thank you for the pointer