sci

https://github.com/babashka/SCI - also see #babashka and #nbb
borkdude 2021-06-24T21:43:17.118500Z

borkdude 2021-06-24T21:44:30.119700Z

So the question is: can you add an entire namespace at once using ns-publics?

hairfire 2021-06-24T21:45:15.120700Z

Yes, but I don't need to use ns-publics if there's a better way.

hairfire 2021-06-24T21:46:14.122400Z

My use case is: I have several functions defined, I read in a file containing Clojure code that only uses those functions, and I want to load-string on file.

Darin Douglass 2021-06-24T21:46:15.122500Z

{:namespaces {'io {'file #(apply files/resolve lh %&)}
                                                      'json (ns-publics 'clojure.data.json)
                                                      'str (ns-publics 'clojure.string)
                                                      'tools (ns-publics 'lh.sci-tools)
                                                      'user {'slurp slurp}}}
Is what I use

Darin Douglass 2021-06-24T21:46:26.123Z

Sorry for poor formatting, on my phone at the moment

hairfire 2021-06-24T21:47:02.123400Z

Ah, I see, use :namespaces not :bindings

borkdude 2021-06-24T21:47:52.124400Z

yes, :bindings is just a short-hand for {:namespaces {'user ...}}

hairfire 2021-06-24T21:48:10.124800Z

I suppose I would need to add something like "(require 'json)" to the top of the file coming in, to use your example @ddouglass

Darin Douglass 2021-06-24T21:48:22.125300Z

Yep

borkdude 2021-06-24T21:48:32.125600Z

you could also just add everything to the user namespace, if that fits your use case

borkdude 2021-06-24T21:49:05.126500Z

or just eval "(require '[json :refer :all]) before evaluating something else

hairfire 2021-06-24T21:51:39.128800Z

I've written a C++ code generator for our embedded development team that takes as input a file of text, which looks a lot like Clojure, loads it, analyzes it, and ouputs the C++ code. To date it required devs to have Java on their machines (e.g., Linux, Windows). I want to use "sci" so I can provide native binaries. It looks like "sci" is going to do the trick.

👍 2
hairfire 2021-06-24T21:52:21.129700Z

Thanks @borkdude for all you hard work, and the latest ClojureD presentation which sparked my interest in making this new native binary version!

👍 1
borkdude 2021-06-24T21:59:38.132Z

@hairfire That sounds like a cool project. Let me know if you run into trouble.

👍 1
hairfire 2021-06-24T22:00:40.132700Z

Hey @borkdude, is http://ko-fi.com the best way to make a one-time contribution?

borkdude 2021-06-24T22:01:27.133Z

yep, thanks :)

👍 1
borkdude 2021-06-29T20:58:22.152600Z

@hairfire I now enabled one time amounts on Github sponsors too. I didn't know this was possible, TIL.