더 점점점 좋다
This commit is contained in:
1 parent
3f825c2750
commit
2ae6f1b3e5
3 files changed
+50
-12
No files matched your search
@@ -73,6 +73,10 @@
|
||||
[(_ :guard wildcard?) _] {}
|
||||
[(x :guard symbol?) _] {x datum}
|
||||
|
||||
[(_ :guard scm/constant?)
|
||||
(_ :guard scm/constant?)]
|
||||
(when (= pattern datum) {})
|
||||
|
||||
[([p (_ :guard ellipsis?) & ps] :seq)
|
||||
(ds :guard seq?)]
|
||||
(let [ds-end (take-last (count ps) ds)
|
||||
@@ -91,14 +95,11 @@
|
||||
(merge-unify (unify p d)
|
||||
(unify (scm/datum->syntax ps pattern)
|
||||
(scm/datum->syntax ds datum)))
|
||||
|
||||
[([] :seq)
|
||||
([] :seq)]
|
||||
{}
|
||||
|
||||
[(_ :guard scm/constant?)
|
||||
(_ :guard scm/constant?)]
|
||||
(when (= pattern datum) {})
|
||||
|
||||
;; no match
|
||||
:else nil))
|
||||
|
||||
@@ -111,15 +112,21 @@
|
||||
(match (scm/syntax-e template)
|
||||
(_ :guard ellipsis?)
|
||||
(throw (IllegalArgumentException. "점점점은 여기 있으면 안 되다."))
|
||||
|
||||
(x :guard symbol?)
|
||||
(match (get unification x)
|
||||
[:ellipsis xs] [:ellipsis xs]
|
||||
nil (throw (Exception. "nosymmm"))
|
||||
x-val x-val)
|
||||
(or (get unification x)
|
||||
(throw (Exception. "nosymmm")))
|
||||
|
||||
(_ :guard scm/constant?)
|
||||
template
|
||||
|
||||
([x (_ :guard ellipsis?) & xs] :seq)
|
||||
(match (transcribe x unification)
|
||||
[:ellipsis x*] (scm/datum->syntax x* template)
|
||||
[:ellipsis x*] (let [xs* (transcribe (scm/datum->syntax xs template)
|
||||
unification)]
|
||||
(scm/datum->syntax
|
||||
(concat x* (scm/syntax-e xs*))
|
||||
template))
|
||||
:else (throw (IllegalArgumentException. "점점점은 나쁘다ㅠㅠ")))
|
||||
|
||||
([x & xs] :seq)
|
||||
|
||||
+3
-1
@@ -55,7 +55,9 @@
|
||||
;; top-level scope를 짓겠는다. 그때 nil/#{}는 `::unresolved`를
|
||||
;; 대신하고 하나의 scope를 이루어진 집합은 #{}를 대신하겠는다.
|
||||
#_(= (syntax-context stx) ::unresolved)
|
||||
(empty? (syntax-context stx)))
|
||||
(let [x (syntax-context stx)]
|
||||
(or (nil? x)
|
||||
(and (coll? x) (empty? x)))))
|
||||
|
||||
(defn resolved? [stx]
|
||||
(not (unresolved? stx)))
|
||||
|
||||
Reference in new issue
Block a user