From 8e142dc7eaf815807b80f857c34fac7ee5318e98 Mon Sep 17 00:00:00 2001 From: vaclavt Date: Mon, 23 May 2022 21:18:53 +0200 Subject: [PATCH] until maco wip --- Readme.md | 1 + debug.lsp | 5 +++++ stdlib/stdlib.lsp | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/Readme.md b/Readme.md index f861617..d8aa8a8 100644 --- a/Readme.md +++ b/Readme.md @@ -77,6 +77,7 @@ utils/local_install.sh - multiline editing (see kilocpp editor) #### Doc +- add doc for macros - add functions from stdlib into doc - doc for set! diff --git a/debug.lsp b/debug.lsp index 75b7e6f..169e207 100644 --- a/debug.lsp +++ b/debug.lsp @@ -1,3 +1,8 @@ +(dotimes i 4 (print i) ) + +(def acc 0) +;(dotimes i 4 (do (set! acc (+ acc i)) (print acc)) ) +(print (dotimes i 4 (do (set! acc (+ acc i)) (print acc))) ) (defmacro until (cnd body) (list 'while '(not (eval cnd)) diff --git a/stdlib/stdlib.lsp b/stdlib/stdlib.lsp index 59beea0..e2c148b 100644 --- a/stdlib/stdlib.lsp +++ b/stdlib/stdlib.lsp @@ -78,6 +78,11 @@ body )) +(defmacro until (cnd body) + (list 'while '(not (eval cnd)) + body + )) + ; return 1 when list contains item otherwise nil (defn member (lst itm)