Fork me on GitHub
#babashka
<
2024-05-29
>
grav08:05:07

clojure.string being aliased as str per default is just chef_kiss !

❤️ 2
borkdude08:05:42

Note that this is only in the default user namespace, not when you create your own namespaces :)

🧠 2
grav08:05:12

That makes sense! Now we're on the topic, would it make sense to have the -i flag being default, when -e is used?

grav08:05:15

Ie, the more convenience, the better?

borkdude08:05:44

I don't plan on adding any more bells and whistles regarding those flags, but what would be your use case?

grav08:05:37

I just went for bb for splitting some string by : in a pipe, and everything was just plain obvious, except maybe for that flag.

grav08:05:17

Honestly, it didn't take much to do bb --help, but still 😄 My casual usages of bb in pipes would be less verbose if it was just bb -e all over the place

borkdude08:05:26

you mean like this?

$ echo 'foo:bar' | bb '(str/split (slurp *in*) #":")'
["foo" "bar\n"]

grav08:05:06

Oh, I thought I needed the -e - and I hadn't considered (slurp *in*) - I don't need input to be a lazy seq

grav08:05:24

Better than my suggestion -thanks 🙂

borkdude08:05:24

Those -i -I etc flags are convenient, but I consider them mostly a left-over from early experiments when bb didn't support as much of Clojure as it does now :)

👍 2
grav08:05:23

When does -e make sense? In the docs it says > -e, --eval <expr> Evaluate an expression. But that's exactly what's happening in your snippet as well?

👍 1
borkdude08:05:36

yeah, -e is good to use, just forgot it in the last snippet I wrote. bb does work without it

borkdude08:05:55

but it's ambiguous when the expression is a string, then it searches for a file

👍 2
m3tti09:05:32

What would be a good routing library for babashka? or should i go the plain route with httpkit?

borkdude09:05:09

you could use https://github.com/askonomm/ruuter or just dispatch on uri yourself

👍 1
m3tti09:05:34

great also found ruuter but thought there would be more opinions about something better. But i allready liked ruuters idea reminds me a bit of hapi in the node world which i liked a lot. So nothing more fancy than that. Than i'll go that rout thank you once again @U04V15CAJ