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-11-29 01:38:54 -0800
committerKartik K. Agaram <vc@akkartik.com>2014-11-29 01:38:54 -0800
commitd68f8ee5504bfe66aff0e8c6795f24508fa532de (patch)
treeeeb43f46150700b2b27854ee66717e40e2504c64 /mu.arc.t
parentd18b7cc7492901ebcde7492121360f51d7697ba7 (diff)
downloadmu-d68f8ee5504bfe66aff0e8c6795f24508fa532de.tar.gz
382 - varargs 'interpolate'
Brilliant, now I didn't need any low-level changes.
Diffstat (limited to 'mu.arc.t')
-rw-r--r--mu.arc.t21
1 files changed, 20 insertions, 1 deletions
diff --git a/mu.arc.t b/mu.arc.t
index 9674641a..700b156b 100644
--- a/mu.arc.t
+++ b/mu.arc.t
@@ -3132,7 +3132,7 @@
 
 ; helper
 (def memory-contains (addr value)
-;?   (prn "Looking for @value starting at @addr")
+;?   (prn "Looking for @value starting at @addr, size @memory*.addr vs @len.value")
   (and (>= memory*.addr len.value)
        (loop (addr (+ addr 1)
               idx  0)
@@ -3208,6 +3208,25 @@
 (if (~memory-contains memory*.3 "hello, abc")
   (prn "F - 'interpolate' splices strings at start"))
 
+(reset)
+(new-trace "interpolate-varargs")
+(add-code '((def main [
+              ((1 string-address) <- new "hello, _, _, and _!")
+              ((2 string-address) <- new "abc")
+              ((3 string-address) <- new "def")
+              ((4 string-address) <- new "ghi")
+              ((5 string-address) <- interpolate (1 string-address) (2 string-address) (3 string-address) (4 string-address))
+             ])))
+;? (= dump-trace* (obj whitelist '("run")))
+;? (= dump-trace* (obj whitelist '("run" "array-info")))
+;? (set dump-trace*)
+(run 'main)
+;? (quit)
+;? (up i 1 (+ 1 (memory* memory*.5))
+;?   (prn (memory* (+ memory*.5 i))))
+(if (~memory-contains memory*.5 "hello, abc, def, and ghi!")
+  (prn "F - 'interpolate' splices in any number of strings"))
+
 ;; unit tests for various helpers
 
 ; addr