Compare commits

..

No commits in common. "8375e19f1ebe9f0781f052c1d6758d0e82491932" and "46817bd4e50e03f547c4f8bd8a3b68c01c2b6f71" have entirely different histories.

3 changed files with 5 additions and 5 deletions

View File

@ -229,7 +229,7 @@
(defp loop-expr group order-1 [(quiet :loop) tuple (quiet :with)
(flat (choice :loop-body [fn-clause compound-loop]))])
(defp repeat-expr group order-1 [(quiet :repeat) (choice :times [:word :number]) non-binding])
(defp repeat-expr group order-1 [(quiet :repeat) (choice :times [:word :number]) block])
(defp collection flat choice [;struct-literal
dict list-literal set-literal tuple])

View File

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

View File

@ -60,8 +60,8 @@
(comment
(def source "
let times = 4
repeat times print! (:foo)
:a (_)
")