98 - getting sick of loading literals before use

This commit is contained in:
Kartik K. Agaram 2014-10-05 10:36:09 -07:00
parent b982e863fa
commit 186e188402
2 changed files with 15 additions and 4 deletions

11
mu.arc
View File

@ -113,10 +113,13 @@
(def m (loc) ; read memory, respecting metadata
;? (prn "m " loc " " sz.loc)
(if (is 1 sz.loc)
(memory* (addr loc))
(annotate 'record
(map memory* (addrs (addr loc) sz.loc)))))
(if (is 'literal ty.loc)
(v loc)
(is 1 sz.loc)
(memory* (addr loc))
:else
(annotate 'record
(map memory* (addrs (addr loc) sz.loc)))))
(def setm (loc val) ; set memory, respecting metadata
;? (prn "setm " loc " " val)

View File

@ -172,6 +172,14 @@
4 1 5 3 6 4))
(prn "F - 'reply' permits a function to return multiple values at once"))
(reset)
(add-fns
'((test1
((1 integer) <- add (2 literal) (3 literal)))))
(run 'test1)
(if (~iso memory* (obj 1 5))
(prn "F - ops can take 'literal' operands (but not return them)"))
(reset)
(add-fns
'((main