Fork me on GitHub

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


@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

👍 4

thanks, that is what i was expecting to happen


but still I think that bb has kind of a problem as explained before, maybe i´m doing something wrong 😅 (i just installed it 😁)


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

👍 4

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?


@shen in babashka you can do this:

$ bb '(Math/pow 2 3)'


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


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


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


@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


FYI @borkdude, my asynchronous js code now works with the npm update 🙂 Thanks!


woohoo 🙂


This is the error


The problem is that after doing that I can’t eval another valid expression


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


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.
Syntax error reading source at (REPL:1).
<NO_SOURCE_FILE> [line 5, col 2] Unmatched delimiter ).


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


Just don't use the REPL without rlwrap I guess


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


by the way, great tool, really fun and really fast, I would like to contribute in the future :thumbsup:


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

👍 4

all tests passed here :thumbsup:

👍 4

I've also tested this example from clojuredocs: