Fork me on GitHub
#babashka
<
2020-01-29
>
raydel9500:01:11

Hi, I had a weird behavior when I was playing with the repl (I just installed babashka, and the repl was the first thing I tried). I explain: I was evaluating some commands in the repl and everything was working fine, until I tried to review the last command that in the history (I didnโ€™t know that history was not supported, at least itโ€™s not working for me), when I checked the command (I just pressed the up key) this ^[[A was the expression that appeard and without noticed I evaluated it ๐Ÿ˜…, this error showed up Could not resolve symbol: [at line 1, column 1] , every was fine until here, the problem was when I tried to eval another expression and nothing happened, I think it can be an error parsing that weird character because when I entered a an invalid closing parenthesis it gave me this error Unmatched delimiter: ), expected: ] to match [ at [9 2] [at line 11, column 1] and after that everything worked fine, It seems like a problem

sogaiu00:01:46

@raydelalonsobaryolo this is not about what you reported, but if rlwrap is available on your system, i think that can provide history functionality, i.e. rlwrap bb

raydel9505:01:14

thanks, that is what i was expecting to happen

raydel9505:01:36

but still I think that bb has kind of a problem as explained before, maybe iยดm doing something wrong ๐Ÿ˜… (i just installed it ๐Ÿ˜)

sogaiu05:01:26

@raydelalonsobaryolo borkdude may be around in a bit and might have something more directly relevant to your report

shen08:01:57

A bit of a general question. If I wanted to calculate an exponent in Clojure or ClojureScript, I can use interop with Java or JS via (Math/pow base exponent) What's an appropriate way to have access to an exponent function in sci?

borkdude08:01:55

@shen in babashka you can do this:

$ bb '(Math/pow 2 3)'
8.0

borkdude08:01:40

For sci you should add the java.lang.Math class to :classes (assuming you're using the JVM version) and if you're using GraalVM, you should also add that class to the reflection config

shen08:01:29

thanks! and if I'm just running in the browser?

shen08:01:09

nm. (sci/eval-string "(Math/pow 1.5 1.5)" {:classes {'Math js/Math}}) seems to work ๐Ÿ™‚

borkdude08:01:02

@raydelalonsobaryolo Isn't this the same you get with clojure?

$ clojure
Clojure 1.10.1
user=> ^[[A
Syntax error reading source at (REPL:1:1).
EOF while reading

jeroenvandijk10:01:27

FYI @borkdude, my asynchronous js code now works with the npm update ๐Ÿ™‚ Thanks!

borkdude10:01:33

woohoo ๐Ÿ™‚

raydel9514:01:43

This is the error

raydel9514:01:53

The problem is that after doing that I canโ€™t eval another valid expression

raydel9514:01:12

however if after that I eval and invalid closing parentheses I get this error Unmatched delimiter: ), expected: ] to match [ at [1 2] [at line 3, column 1], and then everything works fine again

borkdude15:01:01

it seems this is exactly the same behavior of

$ clojure -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.597"}}}' -m cljs.main -re node
ClojureScript 1.10.597
cljs.user=> ^[[A
WARNING: Use of undeclared Var cljs.user/ at line 1 <cljs repl>
Execution error (SyntaxError) at (<cljs repl>:1).
Invalid or unexpected token

(node:60990) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead.
1
2
3
)
Syntax error reading source at (REPL:1).
<NO_SOURCE_FILE> [line 5, col 2] Unmatched delimiter ).

borkdude15:01:43

also of the clojure REPL. Only the error message differs a bit, but I don't see how bb is much different there?

borkdude15:01:23

Just don't use the REPL without rlwrap I guess

raydel9516:01:44

Oh, I see, itโ€™s the same behavior, maybe I was confused because when I run clojure and I reproduce that, the prompt doesnโ€™t showed up again

raydel9516:01:36

by the way, great tool, really fun and really fast, I would like to contribute in the future ๐Ÿ‘

borkdude16:01:57

Good to hear (both about the tool and your intent to contribute)!

sogaiu23:01:29

all tests passed here ๐Ÿ‘

borkdude23:01:32

I've also tested this example from clojuredocs: https://clojuredocs.org/clojure.test/assert-expr