This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-11
Channels
- # announcements (21)
- # aws (2)
- # babashka (20)
- # beginners (47)
- # bristol-clojurians (2)
- # calva (63)
- # cider (24)
- # clj-kondo (22)
- # cljs-dev (3)
- # cljsrn (6)
- # clojars (3)
- # clojure (147)
- # clojure-europe (21)
- # clojure-france (2)
- # clojure-italy (3)
- # clojure-losangeles (1)
- # clojure-nl (3)
- # clojure-spec (2)
- # clojure-uk (70)
- # clojurescript (37)
- # core-logic (6)
- # cursive (4)
- # data-science (2)
- # datomic (99)
- # events (1)
- # figwheel-main (20)
- # fulcro (26)
- # graalvm (6)
- # graphql (5)
- # kaocha (8)
- # leiningen (20)
- # meander (22)
- # nrepl (4)
- # off-topic (27)
- # pathom (5)
- # pedestal (3)
- # re-frame (20)
- # reagent (4)
- # shadow-cljs (43)
- # spacemacs (11)
- # tools-deps (55)
- # tree-sitter (6)
- # vim (8)
- # xtdb (18)
- # yada (14)
I'm trying to parse the output of /usr/bin/swaymsg -t get_inputs
. It produces a multi-line json string that according to a json linter is valid. I've had no success with /usr/bin/swaymsg -t get_inputs | bb '(json/parse-string *input*)'
or with any combination of babashka options. That one produces the error clojure.lang.ExceptionInfo: java.lang.RuntimeException: Invalid token: : [at line 1, column 1]
@shem use cheshire.core in the same way you would on the JVM:
$ echo '{"a": 1,
"b": 2}' | bb '(json/parse-stream *in*)'
{"a" 1, "b" 2}
Nice! No rust?
I tried it from Rust, but I couldn't find a good example of how to call the lib from there and do some gnarly thread pointer thing. This helped: https://towardsdatascience.com/code-in-java-execute-as-c-921f5db45f20
I can believe it’s gnarly!
Is this a start for native libraries?
I don't think native libraries from the perspective of babashka is possible, since the interface (generated by native methods in Java) has to be known at compile time I think
so for the same reason you have to create these classes with native
methods in Java, you can't just do that from pure dynamic Clojure
yeah makes sense
Btw, for those interested I’m using this code to do AWS requests in Graal https://github.com/adgoji/aws-api/blob/master/src/adgoji/cognitect/aws/signers.cljc#L150 It needs some examples, but if you really want to this could be a start. I’ve also used it from Clojurescript (not tested lately) (CC @holyjak I think you were interested)
An example would be very useful :)
I added the Sts example
ah yeah good one
Follow up on using sci as a shared lib: https://github.com/borkdude/sci/blob/master/doc/libsci.md