expr-repeat #19

Merged
scott merged 3 commits from expr-repeat into main 2023-12-24 19:17:17 +00:00
Showing only changes of commit 7541d2499d - Show all commits

View File

@ -811,9 +811,9 @@
times (if (= :word (:type times-expr)) times (if (= :word (:type times-expr))
(resolve-word times-expr ctx) (resolve-word times-expr ctx)
(-> times-expr :data first)) (-> times-expr :data first))
block (second data)] expr (second data)]
(if (not (number? times)) (throw (ex-info (str "Repeat needs a number, not a " (base/get-type times)) {}))) (if (not (number? times)) (throw (ex-info (str "Repeat needs a number, not a " (base/get-type times)) {})))
(dotimes [_ times] (interpret-ast block ctx)))) (dotimes [_ times] (interpret-ast expr ctx))))
(defn- interpret-literal [ast] (-> ast :data first)) (defn- interpret-literal [ast] (-> ast :data first))