From 3f825c27509121dc935fb4b49a377dae4467cce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Madeleine=20Sydney=20=C5=9Alaga?= Date: Thu, 24 Sep 2026 07:05:50 -0600 Subject: [PATCH] =?UTF-8?q?transcribe=20=EC=A0=90=EC=A0=90=EC=A0=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/expand/syntax_rules.clj | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/expand/syntax_rules.clj b/src/expand/syntax_rules.clj index 5a6049b..c4b46e3 100644 --- a/src/expand/syntax_rules.clj +++ b/src/expand/syntax_rules.clj @@ -107,18 +107,7 @@ (scm/datum->syntax-recursive datum)) (update-vals scm/syntax->datum))) -(defn strip-ellipsis [x depth] - (match x - [:ellipsis xs] - (if (< 0 depth) - [:ellipsis (map #(strip-ellipsis % (dec depth)) xs)] - (throw (IllegalArgumentException. "점점점은 나쁘다."))) - :else (if (zero? depth) - x - (throw (IllegalArgumentException. - "depth는 영 아니지만 인수에 점점점이 남지 않는다."))))) - -(defn- transcribe-rec [template unification depth] +(defn transcribe [template unification] (match (scm/syntax-e template) (_ :guard ellipsis?) (throw (IllegalArgumentException. "점점점은 여기 있으면 안 되다.")) @@ -129,22 +118,19 @@ x-val x-val) ([x (_ :guard ellipsis?) & xs] :seq) - (match (transcribe-rec x unification depth) + (match (transcribe x unification) [:ellipsis x*] (scm/datum->syntax x* template) :else (throw (IllegalArgumentException. "점점점은 나쁘다ㅠㅠ"))) ([x & xs] :seq) - (let [xs* (transcribe-rec depth (scm/datum->syntax xs template) unification)] + (let [xs* (transcribe (scm/datum->syntax xs template) unification)] (scm/datum->syntax - (cons (transcribe-rec depth x unification) (scm/syntax-e xs*)) + (cons (transcribe x unification) (scm/syntax-e xs*)) template)) ([] :seq) template)) -(defn transcribe [template unification] - (transcribe-rec template unification 0)) - (defn transcribe* ([template unification] (-> template