Fork me on GitHub
#off-topic
<
2022-12-09
>
borkdude14:12:30

TIL

user=> (get (java.util.HashMap. {(java.lang.Integer. "1") :foo}) (java.lang.Long. "1"))
nil
user=> (get (java.util.HashMap. {(java.lang.Integer. "1") :foo}) (java.lang.Integer. "1"))
:foo

😮 3
dumrat14:12:33

Why?

(= (java.lang.Integer. "1") (java.lang.Long. "1")) ;=> true
(= (.hashCode (java.lang.Integer. "1")) (.hashCode (java.lang.Long. "1"))) ;=> true

Ben Sless14:12:49

Try def-ing the integer twice and then use the names, I have a theory

1
mpenet14:12:20

(hash (long 1)) = (hash (int 1)), but in java nope

ghadi14:12:28

their hashes are equivalent in Java.

ghadi14:12:41

#'hash in clojure is hasheq

mpenet14:12:18

oh right, missed a detail in the gist

ghadi14:12:21

the difference in the Clojure IPM's vs. Java HashMaps is not due to hashing, but due to equality: clojure uses Util.equiv, java uses .equals()

ghadi14:12:56

Long.valueOf(42N).equals(Integer.valueOf(42)) -> false

ghadi14:12:05

in both cases, keys are checked for equality after hashcodes match (though the hashcodes also are calculated with different methods; hashCode() vs clojure's hashEq. they happen to produce the same results for Longs vs. Integers)

borkdude14:12:59

thanks for explaining @U050ECB92

andy.fingerhut19:12:15

Very early design decision in Clojure that = returns true for equal numeric values even if they are different types, UNLIKE Java.

andy.fingerhut19:12:06

Zach Tellman has found this aspect of Clojure's = to be a performance limiter when running on JVMs, vs. other collections that only use Java equals

andy.fingerhut19:12:28

(I believe -- I don't have performance data handy at the moment to point at.)

👍 1
thomas14:12:33

I found ChatGPT actually telling me something that is factually wrong ::scream:

thomas14:12:43

What is a famous guitar solo by Frank Zappa

thomas14:12:50

One of the most famous guitar solos by Frank Zappa is from the song "The Black Page," which appears on his 1976 album "Zoot Allures." The solo is known for its technical difficulty and is considered one of the most challenging guitar solos ever written. The "Black Page" solo features a complex and rapidly changing sequence of notes and rhythms, with Zappa using a variety of different playing techniques and effects to create a unique and distinctive sound. The solo is considered a highlight of Zappa's guitar playing and has been praised by critics and musicians alike for its skill and innovation. In conclusion, the guitar solo from "The Black Page" by Frank Zappa is considered one of his most famous and notable solos, and is renowned for its technical complexity and musical ingenuity.

thomas14:12:10

The Black Page is not on Zoot Allures, Black Napkins is.

thomas14:12:21

and Black Page is mainly a drum part.

jpmonettas14:12:44

yeah, from their page

Martynas Maciulevičius14:12:33

Plausible-looking is actually worse than doing it by hand 😄 It's like code that works and you don't know why. I hope they fix this.

thomas14:12:07

when I told it was wrong it kinda corrected it self

jpmonettas14:12:13

I don't see how that can be fixed, since it is being trained on data that it can't be sure is 100% true

thomas14:12:58

yes, that is a tough one.

dumrat14:12:56

Better to ask forgiveness than profess ignorance 😄 Anyway, it readily corrects itself when told it's wrong. But when it has no knowledge of what it's doing, it just gets stuck in a loop at times.

jpmonettas14:12:06

also, what is truth? just because some history books say it, doesn't mean it is true :man-shrugging:

thomas14:12:51

or not... 😉

1
Apple15:12:35

chatgpt and today's date

Apple15:12:01

pretty happy with chatgpt it's really good

😂 1
p-himik16:12:23

You should've asked it "what was the date 2 years ago". :D

Dmytro Bunin16:12:02

that worked 😄

🎉 3
p-himik16:12:05

So it knows, it just doesn't want to tell you.

😆 1
mauricio.szabo19:12:02

:thinking_face:

Dmytro Bunin19:12:45

pretty consistent

mauricio.szabo19:12:40

The ? made the AI confusing

mauricio.szabo19:12:02

Is it just me? As I told in another thread, I never could get any useful info from any of these AI things!

mauricio.szabo19:12:37

Code that I tried to ask came back incorrect, answers for general questions were incorrect...

mauricio.szabo19:12:20

Even on some art-based AI prompts I saw some work of art, tried to simulate some prompts, and got back nightmares like people with multiple eyes or multiple hands, people with heads growing up from their necks, etc....

Dmytro Bunin19:12:07

I think you need to get lucky with question to get something good

mauricio.szabo20:12:46

Yes, for example, every question that I ask about Emscripten on ChatGPT gets me back delirious results. Like, literally, delirious: I google for the functions ChatGPT gives me, and I get back no results at all

respatialized16:12:58

So... an expensive and dangerous DIY gas electric hybrid?