From bb1d5c2cd33cd196becbc39c3f8d287cf5a080bf Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 11 Oct 2021 21:21:31 -0700 Subject: [PATCH] . --- shell/data.limg | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/shell/data.limg b/shell/data.limg index 03aa276d..02a6fd5e 100644 --- a/shell/data.limg +++ b/shell/data.limg @@ -122,6 +122,18 @@ (while ,test ,@body ,update))]) + (repeat . [# Ideally we shouldn't have to provide +# var. +# But then nested repeats won't work +# until we use gensyms. +# And shell doesn't currently support +# gensyms. +# By exposing var to caller, it becomes +# caller's responsibility to use unique +# vars for each invocation of repeat. +mac (repeat var n . body) + `(for ,var 0 (,var < ,n) (++ ,var) + ,@body)]) (grid . [def (grid m n val) ret g (populate n ()) for i 0 (< i n) ++i