Fork me on GitHub

Finally found a feasible way to include proper clojure.pprint :)

$ ./bb '(clojure.pprint/cl-format true "~R~%" 63)'

🎉 3

(see #babashka_circleci_builds , core-pprint branch)


(sometimes GraalVM binary size is incomprehensible: with some commit the macOS binary size went down with 3MB and I just did a clean up commit and the binary is up with 3MB again)


either way, replacing fipp with clojure.pprint proper (patched for GraalVM) didn't have a significant binary size change


@alekcz360 if you need any help with pod impl let me know

Michael W13:09:31

@thomas.ormezzano Have you see the cognitect aws library? They generate everything from the openapi specifications from aws. I'm using it myself from clojure but it might give inspiration on generating code. I think it might be less fragile than what you described, since if the spec changes you can regenerate your code from the new one without having to manually make changes.


Ah ok interesting I’ll take a look 🙂


ok yeah it looks good but I think it’s more helpful when trying to use the API directly. For the pod it’s more about the actual Go types that are used as input/output to the functions of the sdk so I don’t think that would work as well. I am thinking maybe I could parse the API docs or even the Go code to extract them but I am not really convinced yet.


About the pagination, is the problem that you can't pass functions over pods (or Clojure functions to go for that matter)? Is there a data representation possible that would make sense? I have no idea how much of a problem this is in practice


How does the Go SDK pass this function over HTTP to AWS itself for dealing with this?


or does it fetch everything and then filter?


so my understanding is that the go sdk fetches the pages over http one by one and keeps doing it until there is no more data to fetch or the function passed argument returns false after being eval’d on the page


ah right, so the function can check like: this is the nth page, this is enough?


yeah or I guess if you’re looking for an object in s3 or something you can go start going over the pages and e.g stop when you’ve found what you were looking for


I have not needed that in practice so it’s not really a problem for me but I wonder how often if might be for other people


with pods it's also possible to define macros and "client side" functions by just passing code which will be evaluated on the babashka side. maybe that's something that could be used for this.


ah ok I am not 100% sure I understand what you mean but I need to look into this - I was thinking it could also be possible to send each page back to bb eval the fn there and then pass back the output to Go but that seemed a bit tricky and not really worth it


in the pod you could implement a function that's executed by bb: (loop [...] (let [p (aws/page x)] (if (f p) (recur ....) ...) so then only aws/page (or whatever, this is pseudocode) will be called from the pod, which only fetches a single page at a time and bb itself checks for more


the babashka-sql-pods have examples of how this is used.


e.g. database transactions are implemented using this


ok I see interesting I’ll think about it :thumbsup:


It's really cool to have a Go pod in the family of pods, another good example on which others can build


🙂 yes I think this can be reused as it is for any go pod to do the bencode communication between the pod and bb


did you find it a barrier to work with bencode or was it ok?


tbh I was a bit worried at first but it was actually not a problem at all. There was already a library to do the encoding/decoding and so the bencode part was really easy


Running one bb on the server and opening an nREPL session there (or socket REPL, if you will) and then executing commands from another bb connected to that, yeah that can work


I don't know if ssh running in a java.lang.ProcessBuilder and then sending input to that works, I never tried this.


this is probably basic Clojure knowledge but is there a way to send commands programmatically to an nREPL session or do you need to actually just do a regular REPL type session?


Wow! Awesome. You are a very prolific writer, give St. Thomas Aquinas a run for his money!


Ohhhh, that nrepl "client" is incredibly handy


i often use wikipedia to translate some english term to finnish. i made a simple babashka script to do this without browsers. if it finds an exact answer it shows what the corresponding finnish wikipedia entry would be called. if it gets a disambiguation page, it shows the alternatives. i thought about parameterizing this to enable search between any two languages but then decided that was creeping featuritis.

👍 3

nice and simple :)


tested it locally:

$ translate.clj dog
"Hond – Dutch"


this is working SO WELL!


Made a slight modification for convenience: