This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-13
Channels
- # announcements (5)
- # babashka (23)
- # beginners (3)
- # business (6)
- # clj-kondo (40)
- # clojure (81)
- # clojure-berlin (1)
- # clojure-france (12)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojurescript (4)
- # cursive (7)
- # data-science (1)
- # datascript (1)
- # emacs (9)
- # events (1)
- # fulcro (37)
- # malli (3)
- # meander (5)
- # membrane (2)
- # nrepl (1)
- # parinfer (1)
- # pathom (9)
- # re-frame (31)
- # reitit (10)
- # sci (2)
- # shadow-cljs (3)
- # sql (3)
- # tools-deps (16)
- # uncomplicate (4)
- # vrac (1)
Hey there, is it possible to get Babashka to pretty-print stuff using spit
or similar?
#!/usr/bin/env bb
(binding [*print-pretty* true]
(spit "something.edn" {:pretty {:printed :structure}}))
;; clojure.lang.ExceptionInfo: Could not resolve symbol: *print-pretty* [at /home/tamayo/projects/bread-cms/bin/bread, line 3, column 13]
You can post an issue about this with some examples about what this does. I haven't used it in my 10 years of Clojure :)
/tmp ❯❯❯ cd stuff
/t/stuff ❯❯❯ clj
Clojure 1.10.1
(binding [*print-pretty* true]
(spit "something.edn" {:pretty {:printed :structure}}))
Syntax error compiling var at (REPL:1:1).
Unable to resolve var: *print-pretty* in this context
user=>
what I want is to display write EDN maps on multiple lines, which apparently it doesn't do. So I'll keep digging!
@ctamayo you can use (binding [*out* (io/writer your-file)] (pprint edn))
to write pretty to a file
hmm, that is printing to stdout for me, and writing an empty file
#!/usr/bin/env bb
(ns systems.bread.alpha.cli
(:require
[ :as io]
[clojure.pprint :as pp]))
(defn write! [path content]
(binding [*out* (io/writer path)]
(pp/pprint content)))
(write! "something.edn" {:some :edn})
; $ bin/bread
; {:some :edn}
Hi! Is it still so that the Cognitect aws api cannot be compiled to GraalVM native binary? Id like to make a bb aws lambda (quick cold start) but need to write to S3... Thanks!
@holyjak yes. it's a recurring topic :) you can read a recent discussion about this here: https://clojurians.slack.com/archives/CLX41ASCS/p1599750635174200