1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-26 08:20:27 +00:00

Improve use of @ in match.

This commit is contained in:
Calvin Rose 2020-05-04 18:28:20 -05:00
parent fd70b47768
commit f7b49a2c91

View File

@ -1407,9 +1407,9 @@
~(do (def ,pattern ,expr) ,(onmatch))))
(and (tuple? pattern) (= :parens (tuple/type pattern)))
(if (and (= (pattern 0) '@) (symbol? (pattern 1)))
(if (= (get pattern 0) '@)
# Unification with external values
~(if (= ,(pattern 1) ,expr) ,(onmatch) ,sentinel)
~(if (= ,(get pattern 1) ,expr) ,(onmatch) ,sentinel)
(match-1
(in pattern 0) expr
(fn []