about summary refs log tree commit diff stats
path: root/mu.arc.t
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2014-07-06 02:34:03 -0700
committerKartik K. Agaram <vc@akkartik.com>2014-07-06 02:34:03 -0700
commitceb4710530f280d1051aaa744e086dfe9c7803b3 (patch)
treea43e410c6ba48ab4a14eee14f025bd162f3a347e /mu.arc.t
parent4363daba1f60032a117ffd1d0c34d31120e578ac (diff)
downloadmu-ceb4710530f280d1051aaa744e086dfe9c7803b3.tar.gz
6 - compound functions now return values
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t23
1 files changed, 22 insertions, 1 deletions
diff --git a/mu.arc.t b/mu.arc.t
index 6f51cda9..7c05cefa 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -36,6 +36,7 @@
 ;? (prn memory*)
 (if (~iso memory* (obj 1 1  2 3  3 4))
   (prn "F - early return works"))
+;? (quit)
 
 (clear)
 (add-fns
@@ -48,10 +49,30 @@
     (main
       (1 <- loadi 1)
       (2 <- loadi 3)
-      (add-fn 1 2))))
+      (add-fn 1 2)
+    )))
 (run function*!main)
 ;? (prn memory*)
 (if (~iso memory* (obj 1 1  2 3  3 4
                        ; add-fn's temporaries
                        4 1  5 3))
   (prn "F - parameterized compound fn"))
+
+(clear)
+(add-fns
+  '((add-fn
+      (4 <- read)
+      (5 <- read)
+      (6 <- add 4 5)
+      (return 6)
+      (4 <- loadi 34))
+    (main
+      (1 <- loadi 1)
+      (2 <- loadi 3)
+      (3 <- add-fn 1 2))))
+(run function*!main)
+;? (prn memory*)
+(if (~iso memory* (obj 1 1  2 3  3 4
+                       ; add-fn's temporaries
+                       4 1  5 3  6 4))
+  (prn "F - parameterized compound fn with return value"))
a id='n174' href='#n174'>174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267