1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-25 09:47:17 +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)))) ~(do (def ,pattern ,expr) ,(onmatch))))
(and (tuple? pattern) (= :parens (tuple/type pattern))) (and (tuple? pattern) (= :parens (tuple/type pattern)))
(if (and (= (pattern 0) '@) (symbol? (pattern 1))) (if (= (get pattern 0) '@)
# Unification with external values # Unification with external values
~(if (= ,(pattern 1) ,expr) ,(onmatch) ,sentinel) ~(if (= ,(get pattern 1) ,expr) ,(onmatch) ,sentinel)
(match-1 (match-1
(in pattern 0) expr (in pattern 0) expr
(fn [] (fn []