babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
borkdude 2021-02-16T11:02:33.002800Z

Made an (unedited, improvised) video on how we (at work) solve our deps.edn monorepo issues with a babashka script. https://youtu.be/PIwKYJh3r-Y

šŸ‘ 4
pez 2021-02-16T21:02:19.004800Z

TIL

(#(+ % (#(- % 2) 3)) 3) => 4

pez 2021-02-21T20:24:39.015700Z

Haha.

borkdude 2021-02-21T20:28:08.015900Z

I noticed joker also allows this btw

borkdude 2021-02-21T20:28:29.016100Z

But I think bb / edamame will disallow it also at one point

borkdude 2021-02-21T20:28:32.016300Z

just for compatibility

ericdallo 2021-02-16T21:05:26.004900Z

I thought clojure didn't allow nesting anon functions šŸ˜±

borkdude 2021-02-16T21:06:00.005100Z

babashka does ;)

5
borkdude 2021-02-16T21:06:36.005300Z

There is an issue for this: https://github.com/borkdude/edamame/issues/76

borkdude 2021-02-16T21:08:05.005700Z

clj-kondo should probably warn about this too

borkdude 2021-02-16T21:08:29.005900Z

https://github.com/clj-kondo/clj-kondo/issues/636

borkdude 2021-02-16T21:10:18.006300Z

I dragged that clj-kondo issue all the way to the top now

1
pez 2021-02-16T21:14:35.006800Z

Iā€™m writing a small Clojure primer and had just mentioned ā€œfunction literals canā€™t be nestedā€, then evaluated my example for it. (Which to my surprise wasnā€™t marked by the linter.) Only, I was using a babashka REPL. šŸ˜ƒ

borkdude 2021-02-16T21:15:06.007Z

Maybe discourage those fn literals a bit, since they are ugly anyway

borkdude 2021-02-16T21:15:31.007200Z

This is obviously subjective ;)

borkdude 2021-02-16T21:15:37.007400Z

But I think I could live without them

pez 2021-02-16T21:15:43.007600Z

It needs to be short, donā€™t have room for judging, šŸ˜ƒ

borkdude 2021-02-16T21:17:25.007800Z

make sense ;)

pez 2021-02-16T21:17:25.008Z

They are quite unnecessary, though, I agree. Iā€™m mainly mentioning them as part of mentioning the dispatch character, and also so that you will recognize them when reading Clojure code.

pez 2021-02-16T21:18:22.008200Z

Iā€™m moving more towards ā€œnamedā€ lamdas myself, actually.

borkdude 2021-02-16T21:21:05.008400Z

We could have an optional linter for disallowing fn literals, but I'm not sure if I would go so far as to use it myself

pez 2021-02-16T21:24:46.008600Z

Is Clojureā€™s non-nesting rule a sort of opinion, you think?

borkdude 2021-02-16T21:25:32.008800Z

I think it's mostly to avoid confusion, I don't see another reason

#(foo % #(foo %))

borkdude 2021-02-16T21:26:34.009Z

this expands into

(fn [%1] (foo %1 (fn [%1] (foo %1))))
in sci basically

borkdude 2021-02-16T21:26:42.009200Z

which is just valid clojure

borkdude 2021-02-16T21:28:06.009400Z

user=> '#(foo % #(foo %))
(fn* [%1] (foo %1 (fn* [%1] (foo %1))))

borkdude 2021-02-16T21:29:21.009600Z

I guess nesting fn literals also leads to the problem of shadowed locals

borkdude 2021-02-16T21:29:33.009800Z

which you can have with normal fns as well, but maybe not as much