Use and in hy.core.shadow.comp_op

Makes shadow operator behavior match normal (Python) operator behavior
when said operators are used in chained comparisons.

Resolves #1191
This commit is contained in:
Simon Whalen 2016-12-30 13:11:30 +13:00 committed by Kodi Arfer
parent 7b52530adf
commit b89d142e95

View File

@ -65,7 +65,7 @@
"Helper for shadow comparison operators"
(if (< (len args) 2)
(raise (TypeError "Need at least 2 arguments to compare"))
(reduce operator.and_
(reduce (lambda [x y] (and x y))
(list-comp (op x y)
[(, x y) (zip args (cut args 1))]))))
(defn < [&rest args]