about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-06-20 21:35:02 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-06-20 22:32:03 -0700
commitecc763f092456b4d8c93a3d7f47163e4a32fa7b0 (patch)
tree67563bed58f885432161c31e99775aa01c90bf00
parentdeb610367f88d3271a1e690f8602655c60f2efe6 (diff)
downloadmu-ecc763f092456b4d8c93a3d7f47163e4a32fa7b0.tar.gz
new macro: ret
http://arclanguage.org/item?id=11068
-rw-r--r--shell/data.limg13
1 files changed, 7 insertions, 6 deletions
diff --git a/shell/data.limg b/shell/data.limg
index 8c594004..31510aef 100644
--- a/shell/data.limg
+++ b/shell/data.limg
@@ -18,6 +18,8 @@
     (list . [def (list . args)
   # we should probably make a copy here
   args])
+    (ret . [mac (ret var val . body)
+  `(let ,var ,val ,@body ,var)])
     (len . [def (len l)
   if (no l)
     0
@@ -125,12 +127,11 @@
              dx
              0)))))))))))])
     (read_line . [def (read_line keyboard)
-  (let str (stream)
-  (let c (key keyboard)
-    (while (not (or (= c 0) (= c 10)))
-      (write str c)
-      (set c (key keyboard))))
-  str)])
+  ret str (stream)
+    let c (key keyboard)
+      while (not (or (= c 0) (= c 10)))
+        (write str c)
+        (set c (key keyboard))])
     (wait . [def (wait keyboard)
   while (= 0 (key keyboard))
     ()])