1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-20 02:07:40 +00:00

Change semantics of bracketed tuple equality.

Comparison between different bracket and normal tuples
will now take into account the delimiter type. This solves strange
non-locality issues in the compiler due to this false equality, and is
more consistent with Janet's otherwise strong equality philosophy.
This commit is contained in:
Calvin Rose
2023-03-03 18:24:02 -06:00
parent 75229332c8
commit aa5c987a94
5 changed files with 11 additions and 4 deletions

View File

@@ -228,7 +228,7 @@
(assert (= 14 (sum (map inc @[1 2 3 4]))) "sum map")
(def myfun (juxt + - * /))
(assert (= '[2 -2 2 0.5] (myfun 2)) "juxt")
(assert (= [2 -2 2 0.5] (myfun 2)) "juxt")
# Case statements
(assert

View File

@@ -41,10 +41,10 @@
# Looping idea
(def xs
(seq [x :in '[-1 0 1] y :in '[-1 0 1] :when (not= x y 0)] (tuple x y)))
(seq [x :in [-1 0 1] y :in [-1 0 1] :when (not= x y 0)] (tuple x y)))
(def txs (apply tuple xs))
(assert (= txs '[[-1 -1] [-1 0] [-1 1] [0 -1] [0 1] [1 -1] [1 0] [1 1]]) "nested seq")
(assert (= txs [[-1 -1] [-1 0] [-1 1] [0 -1] [0 1] [1 -1] [1 0] [1 1]]) "nested seq")
# Generators
(def gen (generate [x :range [0 100] :when (pos? (% x 4))] x))