From d68f8ee5504bfe66aff0e8c6795f24508fa532de Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 29 Nov 2014 01:38:54 -0800 Subject: 382 - varargs 'interpolate' Brilliant, now I didn't need any low-level changes. --- mu.arc.t | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'mu.arc.t') 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 -- cgit 1.4.1-2-gfad0