diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2014-10-31 16:22:21 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2014-10-31 16:22:30 -0700 |
commit | d9b215437a93569ecb850de8897fef8df76e1a8c (patch) | |
tree | 63d769c348aee900b56b91fd097d1ba01062de65 /mu.arc.t | |
parent | 32f282b4ae6f78f5b7ef33cde0eb167cabd38a8b (diff) | |
download | mu-d9b215437a93569ecb850de8897fef8df76e1a8c.tar.gz |
188 - new op: 'prepare-reply'
It's needed to allow 'defer' to execute statements on 'reply' without touching the results.
Diffstat (limited to 'mu.arc.t')
-rw-r--r-- | mu.arc.t | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mu.arc.t b/mu.arc.t index a38ddc37..6f26ec7d 100644 --- a/mu.arc.t +++ b/mu.arc.t @@ -1003,6 +1003,27 @@ 4 1 5 3 6 4)) (prn "F - 'reply' permits a function to return multiple values at once")) +(reset) +(new-trace "new-fn-prepare-reply") +(add-fns + '((test1 + ((4 integer) <- arg) + ((5 integer) <- arg) + ((6 integer) <- add (4 integer) (5 integer)) + (prepare-reply (6 integer) (5 integer)) + (reply) + ((4 integer) <- copy (34 literal))) + (main + ((1 integer) <- copy (1 literal)) + ((2 integer) <- copy (3 literal)) + ((3 integer) (7 integer) <- test1 (1 integer) (2 integer))))) +(run 'main) +;? (prn memory*) +(if (~iso memory* (obj 1 1 2 3 3 4 7 3 + ; add-fn's temporaries + 4 1 5 3 6 4)) + (prn "F - without args, 'reply' returns values from previous 'prepare-reply'.")) + ; Our control operators are quite inconvenient to use, so mu provides a ; lightweight tool called 'convert-braces' to work in a slightly more ; convenient format with nested braces: |