Fork me on GitHub
#babashka
<
2022-03-13
>
craftybones06:03:30

What would be a recommended way to read from stdin using nbb? fs? process?

craftybones15:03:32

Ah cool, sure

craftybones06:03:47

Is there something simpler maybe?

borkdude16:03:51

OK, here we go! #specter in #babashka, all specter's tests are passing! Install the latest dev preview:

bash <(curl ) --version 0.7.8-SNAPSHOT --dir .
Then try this script:
(require '[babashka.deps :as deps])

(deps/add-deps '{:deps {com.rpl/specter {:git/url ""
                                         :git/sha "8ba809a2cd35d3b6f8c5287e6bd3b4e06e42f6dc"}}})

(require '[com.rpl.specter :as s])

(s/transform [(s/walker number?) odd?] inc {:a 1 :b [1 2 3]})
with:
./bb specter.clj
and it should print:
{:a 2, :b [2 2 4]}

🤯 3
🚀 5
Ferdinand Beyer17:03:02

One more reason to finally learn how to use Specter!

borkdude19:03:10

Babashka 0.7.8! This release improves compatibility with several libraries: https://github.com/aysylu/loom, https://www.hugsql.org/ and https://github.com/redplanetlabs/specter! To use specter in babashka, use the following coordinates:

{:deps {com.rpl/specter {:git/url ""
                         :git/sha "8ba809a2cd35d3b6f8c5287e6bd3b4e06e42f6dc"}}}
Hopefully the compatibility commit can be upstreamed back into specter at some point. • Add clojure.data.priority-map as built-in library - this makes babashka compatible with https://github.com/aysylu/loom • Add part of clojure.tools.reader.reader-types to support https://www.hugsql.org/https://github.com/babashka/babashka/issues/1204 add property babashka.config to reflect bb.edn location (https://github.com/mknoszlig) • Several fixes and enhancements to run Red Planet Lab's https://github.com/borkdude/specter/commit/8ba809a2cd35d3b6f8c5287e6bd3b4e06e42f6dc library in babashka • https://github.com/babashka/babashka/issues/1199: support print-method impls on records • babashka.fs: add windows? predicate • SCI: add *clojure-version* and (clojure-version) • Add java.util.zip.Deflater and java.util.zip.DeflaterOutputStream • SCI: implement declare as macro • https://github.com/babashka/babashka/issues/938: drop location metadata from symbols, except top level Full changelogs: https://github.com/babashka/babashka/blob/master/CHANGELOG.md

🎉 6