1
1
mirror of https://github.com/kanaka/mal.git synced 2024-11-10 12:47:45 +03:00

Cleanup mal-value=

This commit is contained in:
Iqbal Ansari 2016-08-28 19:57:09 +05:30
parent 97c2c420d5
commit b6fce2eea0

View File

@ -135,20 +135,14 @@
(when (and (typep value1 'mal-data)
(typep value2 'mal-data))
(if (equal (mal-data-type value1) (mal-data-type value2))
(switch-mal-type value1
(number (= (mal-data-value value1) (mal-data-value value2)))
(boolean (equal (mal-data-value value1) (mal-data-value value2)))
(nil (equal (mal-data-value value1) (mal-data-value value2)))
(string (string= (mal-data-value value1) (mal-data-value value2)))
(symbol (mal-symbol= value1 value2))
(keyword (mal-symbol= value1 value2))
(list (mal-sequence= value1 value2))
(vector (mal-sequence= value1 value2))
(hash-map (mal-hash-map= value1 value2))
(any nil))
(when (or (and (mal-list-p value1) (mal-vector-p value2))
(and (mal-list-p value2) (mal-vector-p value1)))
(mal-sequence= value1 value2)))))
(switch-mal-type value1
(list (mal-sequence= value1 value2))
(vector (mal-sequence= value1 value2))
(hash-map (mal-hash-map= value1 value2))
(any (equal (mal-data-value value1) (mal-data-value value2))))
(when (or (and (mal-list-p value1) (mal-vector-p value2))
(and (mal-list-p value2) (mal-vector-p value1)))
(mal-sequence= value1 value2)))))
(defun hash-mal-value (value)
(sxhash (mal-data-value value)))