Fork me on GitHub
#sci
<
2020-09-22
>
rickmoynihan07:09:29

@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

borkdude07:09:01

Looks good!

borkdude07:09:27

Maybe add a check for qualified symbol?

borkdude07:09:46

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

borkdude08:09:13

Also:

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

borkdude09:09:22

The constructor bug has also been fixed on bb master

jeremys14:09:37

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 ?

borkdude14:09:15

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/

borkdude14:09:45

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

borkdude14:09:45

depending on what you want to do

jeremys14:09:44

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

jeremys14:09:20

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

jeremys14:09:29

Thanks it works for my case.

rickmoynihan21:09:06

@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.

borkdude21:09:50

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

rickmoynihan21:09:12

Amazing, thank you!