Fork me on GitHub
#babashka
<
2020-06-25
>
bbss07:06:56

@borkdude in JS land it's okay to call a function with a "wrong" arity. For example in d3 and http://deck.gl you have the accessor pattern, where you supply a function to extract some data from each item of a collection. That function gets passed each item, but also additional contextual info.

bbss07:06:19

so I compile a (fn [datapoint] (:value datapoint))

bbss07:06:30

but the library calls that function with extra info, that errors.

borkdude07:06:11

yeah in that case you should probably make the signature varargs

borkdude07:06:39

There could be an option to disable arity checking

borkdude07:06:53

but so far I haven't been able to image why one would like to do that

borkdude07:06:30

I can see it being useful on a function by function basis, but varargs is already the way to do that

👍 3
borkdude07:06:06

@kevin.van.rooijen recently experimented with {:classes {:allow :all 'js goog/global} to allow global interop with js/... stuff, I believe plexus also has tried it

bbss08:06:47

agreed, working with (fn [datapoint & args] ..) works well enough, but an anonymous function called like that in regular cljs won't error.

bbss08:06:10

I was already using :classes {:allow :all} but hadn't tried the 'js goog/global yet. That will be useful.

borkdude09:06:11

Btw, would it make sense to have a separate sci channel? Or are babashka users also interested in the sci library discussions?

jeroenvandijk09:06:56

People could follow both channels? I think it makes sense to seperate it, Babashka and Sci are different enough. Main traffic will still go to Babashka I assume

borkdude09:06:30

Done: #sci

👌 3
borkdude09:06:59

OK, created a #sci channel. People interested in using or developing the #sci library can (also) go there.

borkdude10:06:57

@plexus If I invite @logbot into the #sci channel, that's sufficient for getting the logs to https://clojurians-log.clojureverse.org/?

kolharsam14:06:29

hey everyone! need some help. how would you perform find and replace certain text recursively across a directory and it's sub-dirs using bb?

borkdude14:06:39

@kolhar730 probably something like file-seq + str/replace

👍 6
dpsutton14:06:07

sed can edit files in place. maybe file-seq plus sed

👍 6
bhurlow16:06:19

what's the preferred way of dealing with the AWS api from babashka?

borkdude16:06:39

unfortunately not, but @jeroenvandijk could maybe tell you more. shelling out to a CLI or talking via HTTP always works