Fork me on GitHub
#babashka
<
2021-11-30
>
mbjarland13:11:51

fyi @borkdude - figured it might be fun to have babashka on apple silicon. Turns out graal support doesn’t seem to be there yet so I initiated some activity on the relevant graal ticket at: https://github.com/oracle/graal/issues/2666

borkdude13:11:29

I've been following the discussion, subscribed a while ago. Thank you for looking into it.

mbjarland13:11:45

yeah : ) to me it seems a bit surprising that the activity level is where it is…I suspect a whole lot of devs will be getting their hands on apple silicon cpus and not having support seems just short sighted. We’ll see where it lands, at least they seem responsive

mbjarland13:11:17

naturally the main driver for working on getting graal running is babashka : )

brazil-parrot 1
borkdude13:11:18

Perhaps they mostly focus on cloud -- consumer electronics isn't where the most money can be saved with native image

mbjarland13:11:08

maybe…to me the dream of combining the eco system and languages on the jvm with the ability to build native executables is quite a lot bigger than the hype it has (not) been getting

borkdude14:11:33

I know right :)

borkdude15:11:10

Dominic Freeston writes about how he converted his Cryogen blog to babashka. https://freeston.me/posts/2021-11-29-new-site-generator/

borkdude15:11:24

^ that's really sweet (both design and code) if you ask me

tylerw16:11:04

is there a pattern for using babashka as in interactive part in a pipe? Meaning, you drop into a repl, manipulate the input, and then print the output for use in the next step in the pipeline. For example, say I wanted to do something with a subset of my installed brews, but I’m not 100% sure how to transform the json to a newline delimited list for xargs to process and I want to use the repl to come up with that transformation:

brew info --json=v1 --installed  | bb repl | xargs ... 

tylerw16:11:43

and in the repl I read in *input*, etc.

borkdude16:11:10

absolutely. you can do this. I recommend using rlwrap bb

borkdude16:11:00

it's tricky :)

tylerw16:11:18

yeah 🙂. When I try bb drops into a repl and attempts to execute the json as if it were Clojure

borkdude16:11:18

the REPL reads from stdin and you cannot have two stdins at the same time

tylerw16:11:08

there’s a utility called vipe that drops you into vim in a pipeline with the input (e.g., ls | vipe | xargs ...), maybe I’ll have a look to see how that works

borkdude16:11:38

it's probably easier to launch brew from babashka and then read the input, launch repl, etc. all from bb process

borkdude16:11:45

having dinner, brb

tylerw16:11:09

That’s probably best, rather than spending time to figure out this use case. Thanks 🙂

tylerw17:11:51

btw, it looks like vipe is just a simple wrapper that writes stdin to a temp file, launches the editor of your choice with that file as its argument, then reads the file after the editor exits and prints it to stdout

borkdude18:11:20

hacked something together based on what vipe was doing

tylerw18:11:37

Awesome! Let me give it a spin

tylerw19:11:08

Works like a charm:

❯ brew info --json=v1 --installed | ./bipe | xargs which
Evaluate 'stdin' to see piped input.
The last return value is piped to the next command.
Use :repl/quit to quit the REPL.
user=> (-> (json/parse-string stdin) rand-nth (get "name"))
"git"
user=> ^D
/usr/local/bin/git

🎉 2
martinklepsch23:11:31

Is random-uuid not supported in nbb? I’m getting unresolved symbol errors