Was just working through some exercise in the Olsen's book Getting Clojure in Chlorine and when I tried to submit one of the forms for evaluation nothing happened
Here is the code that I was working on: (def ISBN-LENGTH 13) (def OLD-ISBN-LENGTH 10) (defn valid-isbn [isbn] (or (= (count isbn) OLD-ISBN-LENGTH) (= (count isbn) ISBN-LENGTH)))
I then type (valid-isbn 05967) to test it out (not realizing at the time that count doesn't work on a number) and when I attempt to submit with Sean Corfield's Ctrl+;Shift+B (the Atom keymap for REBL Top Block) then nothing happens, I don't get any result, any error message or anything
If I type (valid-isbn "05967") and submit for evaluation it works as expected, so not sure why using a number as the argument results in nothing happening - is this some protection mechanism to prevent me entering incorrect inputs?
05967 isn't valid in clojure (number literals can't start with 0). however, valid-isbn
won't work on numbers because count
only works on collections and a number is not a collection
OK but shouldn't it still evaluate and blow up with an exception?
it should
Or at least print some message as to why it won't run
I submit it and just nothing happens at all
unfortunately, I'm not familiar with chlorine and rebl integration
I thought Atom was hanging or I'd accidentally pressed something to make it switch to some other mode or something like that but when I type in other things it still submits and evaluates as normal
Thanks for the input anyways phronmophobic 🙂
typing 05967 is a parse error, which might be treated differently than other types of errors
maybe you'll get the same non-result if you type {(:1
OK yes I just tried without leading zero
It evaluates and throws exception for using count on a number
As expected
Still I think there should be a message for using a leading zero?
It seems not right to do absolutely nothing so maybe a bug?
agreed. I wouldn't be surprised if the author just never noticed because they never tried to evaluate something that wouldn't parse
OK
It doesn't work with the built in eval either -- not just via my wrapped eval.
OK so is that a Chlorine bug then?
I guess so. As @smith.adriane says, I suspect most of us have never noticed because we haven't tried to evaluate code that won't read.
If you type that into a bare REPL, it can't even be read -- so it fails before evaluation.
user=> 05967
Syntax error reading source at (REPL:18:0).
Invalid number: 05967
Ha ha yeah I guess only noobs like me find this stuff 😂
OK but at least you get a message in the bare REPL
In particular:
user=> (no-such-function 05967)
Syntax error reading source at (REPL:18:25).
Invalid number: 05967
Syntax error reading source at (REPL:18:26).
Unmatched delimiter: )
user=>
note that it a) doesn't complain about no-such-function
not existing and b) doesn't even read the closing )
.^ That's just to illustrate how early in the read-eval-print process it fails @flyingpython
Hi, well, there are a few tests to fail unparseable code, but maybe something escaped :D
OK thanks for the info, would be interesting to learn more about the different steps involved in the REPL process
Can you open an issue with the code that's failing? Will look at it very soon :)
OK cool will do! Can it wait for couple hours though? Just gotta whip out for some lunch 🙂
Don't worry, the bug will still be there when you get back! 🙂
Hang on, I'm entering bug now, still got some time