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:
parent
7b52530adf
commit
b89d142e95
@ -65,7 +65,7 @@
|
|||||||
"Helper for shadow comparison operators"
|
"Helper for shadow comparison operators"
|
||||||
(if (< (len args) 2)
|
(if (< (len args) 2)
|
||||||
(raise (TypeError "Need at least 2 arguments to compare"))
|
(raise (TypeError "Need at least 2 arguments to compare"))
|
||||||
(reduce operator.and_
|
(reduce (lambda [x y] (and x y))
|
||||||
(list-comp (op x y)
|
(list-comp (op x y)
|
||||||
[(, x y) (zip args (cut args 1))]))))
|
[(, x y) (zip args (cut args 1))]))))
|
||||||
(defn < [&rest args]
|
(defn < [&rest args]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user