Fork me on GitHub
#babashka
<
2024-01-25
>
Ingy döt Net13:01:33

In bb:

user=> [ ##NaN ##Inf Double/NaN ]
[##NaN ##Inf ##NaN]
user=> Double/Inf
java.lang.IllegalArgumentException: No matching field found: Inf for class java.lang.Double [at <repl>:3:-10]
user=> (type ##Inf)
java.lang.Double
why is Double/Inf not working there?

1
borkdude13:01:41

for the same reason it doesn't work in clj?

$ clj
Clojure 1.12.0-alpha5
user=> Double/Inf
Syntax error compiling at (REPL:0:0).
Unable to find static field: Inf in class java.lang.Double

Ingy döt Net13:01:30

$ bb -e Double/POSITIVE_INFINITY
##Inf

Ingy döt Net13:01:06

$ bb -e Double/NEGATIVE_INFINITY
##-Inf

Ingy döt Net13:01:19

kudos to lein repl tab completion 🙂

borkdude13:01:29

are you posting these examples to make a point?

Ingy döt Net13:01:30

Right. I figured out what inf is called in java.

Ingy döt Net13:01:58

I had assumed that since ##NaN was Double/NaN then ##Inf would be Double/Inf

Ingy döt Net14:01:26

And to round it out I just learned about ##-Inf

$ bb -e '(== ##-Inf Double/NEGATIVE_INFINITY)'
true

borkdude14:01:51

double negative infinite is still negative infinity... right? 😅

2
Ingy döt Net14:01:47

##--Inf deletes your hard drive!

😱 1