sci

djblue 2023-01-24T05:36:21.566199Z

What would a version of https://github.com/babashka/babashka/blob/master/src/babashka/impl/clojure/core.clj#L40-L56 look like in sci for cljs?

borkdude 2023-01-24T15:27:11.056409Z

I think similar. Can you expand on why / where you would need this?

djblue 2023-01-24T16:32:03.901159Z

Trying to build something similar to https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/server.clj#L191 for sci in cljs

djblue 2023-01-24T16:33:13.443369Z

Specifically, trying to add it here https://github.com/djblue/portal/blob/master/src/portal/ui/sci.cljs#L34

djblue 2023-01-24T16:34:19.989639Z

I would like to correlate results with the forms that generated them, this is nice when the user submits multiple forms at one

borkdude 2023-01-24T17:44:50.478009Z

right. the babashka prepl implementation also uses read+string

👍 1
djblue 2023-01-24T17:47:22.594839Z

Yeah, in cljs land, the reader you get back is an https://github.com/clojure/tools.reader/blob/master/src/main/cljs/cljs/tools/reader/reader_types.cljs#L102 which is a little different from clj land.

borkdude 2023-01-24T17:47:59.408569Z

@djblue I think I can make this available in SCI as well, we have parse-next, we could do parse-next+string

borkdude 2023-01-24T17:48:25.076729Z

edamame already supports preserving the source string but as metadata, which won't work for numbers, etc

👍 1
borkdude 2023-01-24T17:48:31.913079Z

but the ingredients are already there

djblue 2023-01-24T17:48:58.777349Z

That would be awesome!

borkdude 2023-01-24T17:49:54.717269Z

you will need to use this reader in that case: https://github.com/borkdude/edamame/blob/88564cb28533a80472e2350099acf1878c4cfd58/src/edamame/impl/parser.cljc#L828

borkdude 2023-01-24T17:52:05.838319Z

(is (= "#(+ 1 2 3)" (:source (meta (p/parse-next (p/source-reader "#(+ 1 2 3)")
                                                   (p/normalize-opts {:all true :source true}))))))

borkdude 2023-01-24T17:52:40.381499Z

let's see if we can add parse-next+string

borkdude 2023-01-24T22:31:46.842649Z

A SCI + JNA example: https://twitter.com/borkdude/status/1618006680662605831 https://github.com/borkdude/jna-native-image-sci Thanks @smith.adriane for doing the initial research on this!

2
🤩 1