~bouncepaw/agidel-stdlib

c03a86dbfbe6706d9f5870682c546a62d0b21fc0 — Timur Ismagilov 5 years ago 42d2bd8
Add for to Agidel/C
1 files changed, 10 insertions(+), 0 deletions(-)

M c.scm
M c.scm => c.scm +10 -0
@@ 287,4 287,14 @@
      (format "switch (~A) {\n~A\n}\n"
              key
              (-string-join (-map case-expand (-list 'clause ...)) "")))))

 (define-syntax for
   (syntax-rules ()
     ((_ init-vars test iter-expr body ...)
      (format "~A\n~A"
              (-if (-list? (-car 'init-vars))
                   (expand (cons 'defvar 'init-vars))
                   (defvar 'init-vars))
              (while test
                     (-apply -string-append iter-expr (-list body ...)))))))
 )