Fork me on GitHub

What's the difference between running bb and bb repl (in a Linux terminal)? The screen looks the same to me.

Bob B14:02:20

bb has several subcommands; if no subcommands are provided, the subcommand implicitly used is repl

šŸ‘ 2

Argh, I should have read to the very last line of bb help . Thanks!


I'm using borkdude/jet to convert json to edn, having too minor issues: ā€¢ --keywordize turns json strings like: "@class" to clj keywords like :@class ā€¢ commas, I don't need them, how do I remove 'em?


You can pass a function to --keywordize and do whatever you want


Ah, cool. Thank you. Will try that! Appreciate it!


About commas, I don't think Clojure has a way to not print those when printing maps


Right, right... I am having my first senior moment or something šŸ™‚ I quite forgot, I asked you about commas long ago, you told me to use zprint instead if they bother me so much


@U0G75ARHC I think you can also write a tiny babashka script to rip out the commas from maps using rewrite-clj


it's alright, it ain't biggy. I'm basically using it to convert responses when poking into APIs from Emacs. I would run a query; it comes back with json; there's a hook fn, it grabs the content and feeds it into call-process-region.


which on its turn calls jet and voila


I love it. I can then quickly dissect the data, see the count, filter, map, etc. Damn, I wish more people knew how much better EDN is compared to json. It's more concise and much more readable; you can quickly align things, sort, group and filter.

šŸ‘ 2

I used to get annoyed when someone sends me a link to a json snippet "grrr.. why do I have to stare at this monstrosity?"... now, I'd just run my transform function (that uses jet), and immediately see what's up


Out of curiosity I tried stripping commas with rewrite-clj:

user=> (str (let [loc (z/of-string "{:a 1, :b 2}")] (loop [loc loc] (let [next (z/next* loc)] (if (z/end? loc) (z/root loc) (if (= :comma (z/tag loc)) (recur (z/remove* loc)) (recur next)))))))
"{:a 1 :b 2}"
cc @UE21H2HHD

clojure-spin 4
šŸ†’ 4
babashka 2

Maaan, sometimes I'm scared to talk to you. You think faster in Clojure, than I can type in English.


Here's the script:

borkdude@m1 ~/dev/babashka (master*) $ echo '{:a 1 :b 2}' | jet
{:a 1, :b 2}
borkdude@m1 ~/dev/babashka (master*) $ echo '{:a 1 :b 2}' | jet | /tmp/
{:a 1 :b 2}
borkdude@m1 ~/dev/babashka (master*) $ cat /tmp/
#!/usr/bin/env bb

(require '[ :as z])

(-> (let [loc (z/of-string (slurp *in*))]
       (loop [loc loc]
         (let [next (z/next* loc)]
           (if (z/end? loc) (z/root loc)
               (if (= :comma (z/tag loc))
                 (recur (z/remove* loc))
                 (recur next))))))


metal 8
šŸ‘ 2
šŸ¤“ 2