Fork me on GitHub
#babashka
<
2019-11-13
>
holyjak09:11:20

@borkdude It would be great to have java.util.regex.Pattern/quote available in bb

holyjak09:11:06

And clojure.core/escape

borkdude09:11:31

@holyjak Sure. Can you make an issue for those, preferably with an example of how to use them in bb

borkdude09:11:47

I'm working on the bug from yesterday now

borkdude13:11:45

@holyjak Issue with macro-named binding should be solved on master: https://1678-201467090-gh.circle-artifacts.com/0/release/babashka-0.0.27-SNAPSHOT-macos-amd64.zip

$ ./bb '(defn f [fn] (fn)) (f #(inc 2))'
3

holyjak14:11:30

Yes I can now use fn as an argument name. Thank you!

borkdude13:11:00

Can you give this a spin? If everything's working as expected, I'll look at the other issues

borkdude15:11:01

@holyjak clojure.string/escape is already supported:

$ bb '(clojure.string/escape "hello!" {\! "!!!"})'
"hello!!!"

holyjak15:11:03

Ah,ok ,then I did something wrong when I tried to use it

borkdude15:11:45

you mentioned clojure.core/escape at 10.07AM. Maybe that's what was wrong

holyjak18:11:36

Probably :)

borkdude15:11:14

$ bb '(str/escape "hello!" {\! "!!!"})'
"hello!!!"

jeroenvandijk16:11:43

Is it possible to support clojure.walk/postwalk and clojure.walk/prewalk? I use it a lot in normal clojure code

jeroenvandijk16:11:05

I'm curious if it was a technical decision or just not implemented yet

jeroenvandijk16:11:12

(I would be happy to do a pull request once I miss it in practise)

borkdude16:11:50

just not implemented yet

jeroenvandijk16:11:02

cool, good to hear 🙂

borkdude16:11:52

I could do it myself, it's relatively simple, but I appreciate PRs, so more people find their way around the code

borkdude17:11:26

As a pointer, here is how the clojure.data.csv namespace is added: https://github.com/borkdude/babashka/blob/master/src/babashka/impl/csv.clj

jeroenvandijk17:11:23

ah ok, looks simple. Let me or someone else try it 🙂

borkdude17:11:20

@holyjak https://1683-201467090-gh.circle-artifacts.com/0/release/babashka-0.0.27-SNAPSHOT-macos-amd64.zip

$ ./bb '(def should-be-true false) (assert should-be-true)'
Assert failed: should-be-true

borkdude17:11:43

Also introduced a --verbose option which will print the entire stacktrace like before

borkdude21:11:43

@holyjak The entire java.util.regex.Pattern class is usable from babashka now: https://1689-201467090-gh.circle-artifacts.com/0/release/babashka-0.0.27-SNAPSHOT-macos-amd64.zip

borkdude21:11:57

e.g.:

$ ./bb "(vec (.split (java.util.regex.Pattern/compile \"f\") \"gfgfg\"))"
["g" "g" "g"]

borkdude22:11:49

Better error messages for def/fn/defn:

$ ./bb '(inc 1) (defn f)'
Parameter declaration missing. [at line 1, column 9]