sci

https://github.com/babashka/SCI - also see #babashka and #nbb
2020-09-22T07:43:29.015700Z

@borkdude: Looks like the tests have all passed on my PR: https://github.com/borkdude/sci/pull/424 I think this is roughly what you meant, but let me know if you want me to make any more changes

borkdude 2020-09-22T07:48:01.016Z

Looks good!

borkdude 2020-09-22T07:48:27.016200Z

Maybe add a check for qualified symbol?

borkdude 2020-09-22T07:48:46.016500Z

user=> (find-var '+)
Execution error (IllegalArgumentException) at user/eval1 (REPL:1).
Symbol must be namespace-qualified

borkdude 2020-09-22T08:28:13.016700Z

Also:

user=> (find-var 'foo/bar)
Execution error (IllegalArgumentException) at user/eval143 (REPL:1).
No such namespace: foo

2020-09-22T09:14:56.016900Z

:thumbsup:

borkdude 2020-09-22T09:59:22.017300Z

The constructor bug has also been fixed on bb master

2020-09-22T10:12:04.017500Z

ahh amazing!

2020-09-22T14:02:37.020700Z

Hi it seems I can stop asking questions... Is there a Clojurescipt equivalent to:

(sci/binding [sci/out *out*] 
  (sci/eval-string "(println \"something\")"))
In other word can I bind something to make println work when using sci from Clojurescript? Do I need to use console.log ?

borkdude 2020-09-22T14:04:15.021700Z

Very good question. I think xterm-sci is currently the best example, but I think it might be better for the future of sci started supporting *print-fn* for CLJS. https://github.com/babashka/xterm-sci/blob/main/src/xterm_sci/core.cljs https://babashka.org/xterm-sci/

borkdude 2020-09-22T14:04:45.022400Z

But you can also just re-bind println directly using the :namespaces option

borkdude 2020-09-22T14:05:45.023300Z

depending on what you want to do

2020-09-22T14:06:44.024200Z

I'll take a look at the example thanks! I'll also the rebinding option, didn't think of that one!

2020-09-22T14:09:20.025700Z

If I get it right the sci internal 'clojure.core/println is bound to cljs.core/println that's neat. I'll try that!

borkdude 2020-09-22T14:09:48.025900Z

yup

2020-09-22T14:14:29.026600Z

Thanks it works for my case.

2020-09-22T21:15:06.027500Z

@borkdude: I’ve updated: https://github.com/borkdude/sci/pull/424 With some error handling to mimic clojure’s behaviour, let me know if you require any further tweaks.

borkdude 2020-09-22T21:19:50.027700Z

Excellent. Merged. Also updated bb master:

$ lein bb "(find-var 'clojure.string/join)"
#'clojure.string/join

borkdude@MBP2019 ~/Dropbox/dev/clojure/babashka (master) $ lein bb "(find-var 'clojure.string/joinz)"
borkdude@MBP2019 ~/Dropbox/dev/clojure/babashka (master) $ lein bb "(find-var 'clojure.stringx/joinz)"
----- Error --------------------------------------------------------------------
Type:     java.lang.IllegalArgumentException
Message:  No such namespace: clojure.stringx
Location: <expr>:1:1

----- Context ------------------------------------------------------------------
1: (find-var 'clojure.stringx/joinz)
   ^--- No such namespace: clojure.stringx

----- Stack trace --------------------------------------------------------------
user - <expr>:1:1

Error encountered performing task 'run' with profile(s): 'test'
Suppressed exit
borkdude@MBP2019 ~/Dropbox/dev/clojure/babashka (master) $ lein bb "(find-var 'clojure)"
----- Error --------------------------------------------------------------------
Type:     java.lang.IllegalArgumentException
Message:  Not a qualified symbol: clojure
Location: <expr>:1:1

----- Context ------------------------------------------------------------------
1: (find-var 'clojure)
   ^--- Not a qualified symbol: clojure

----- Stack trace --------------------------------------------------------------
user - <expr>:1:1

Error encountered performing task 'run' with profile(s): 'test'
Suppressed exit

2020-09-22T21:21:12.028Z

Amazing, thank you!