4 ms·
Fixed in TXR Lisp: This is the TXR Lisp interactive listener of TXR 236. Quit with :quit or Ctrl-D on empty line. Ctrl-X ? for cheatsheet. 1> (defparm my
by kazinator 7y ago
Fixed in TXR Lisp:
This is the TXR Lisp interactive listener of TXR 236.
Quit with :quit or Ctrl-D on empty line. Ctrl-X ? for cheatsheet.
1> (defparm my (hash))
my
2> (defparm thy (hash))
thy
3> (set [my 'one-entry] "one")
"one"
4> (set [thy 'one-entry] "one")
"one"
5> (equal my thy)
t
6> (set [thy 'two-entry] "two")
"two"
7> (equal my thy)
nil
Or, briefly:
7> (equal #H(() (a b)) #H(() (a b)))
t
8> (equal #H(() (a b)) #H(() (a c)))
nil
Also this:
[1]> (equal '(1 2) '(1 2))
T
[2]> (equal '(1 2) '(1 2.0))
NIL
[3]> (equal #(1 2) #(1 2)) ;; oops, WTF?
NIL
[4]>
1> (equal '(1 2) '(1 2))
t
2> (equal '(1 2) '(1 2.0))
nil
3> (equal #(1 2) #(1 2))
t
4> (equal #(1 2) #(1 2.0))
nil
- j-pb 7y agoNice to hear, not CL tho ;P The (equal '(1 2) '(1 2.0)) is really a tricky one. Clojure also fails the (= 1 1.0) test. But I'm really not sure if that's a bad thing. I mean (= [1] #{1}) (an ordered vector and an unordered set) is also false, so it kinda makes sense to argue that distinct types are always distinct. However in clojure (= '(1) [1]) which I find a lot harder to defend It's caused by an automatic conversion to sequences which are then compared, and I think I might even add that one to the "warts" list.
- lispm 7y agoCompare that with the rules of equality of Clojure: https://clojure.org/guides/equality https://clojure.org/guides/equality