about summary refs log tree commit diff stats
path: root/074list.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-05-20 11:59:02 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-20 11:59:02 -0700
commit02d8601c90bfb2a90328e57668ae7d53d5f4cfc1 (patch)
treed69f17dbcc48e3256ab093a674c7424fcb902dc5 /074list.mu
parent4fcf032b9a0901d65ba9e2c64dbe344b09e380d7 (diff)
downloadmu-02d8601c90bfb2a90328e57668ae7d53d5f4cfc1.tar.gz
2985 - allow multiple pointers within lists
Earlier, this wasn't legal:

  y:address:list:number <- push 34, x:address:list:number

(So that x and y would point to different places in the list.)

However, functional code relies on this ability a lot.
Diffstat (limited to '074list.mu')
-rw-r--r--074list.mu5
1 files changed, 2 insertions, 3 deletions
diff --git a/074list.mu b/074list.mu
index 833a52cb..5244deec 100644
--- a/074list.mu
+++ b/074list.mu
@@ -8,12 +8,11 @@ container list:_elem [
   next:address:list:_elem
 ]
 
-def push x:_elem, in:address:list:_elem -> in:address:list:_elem [
+def push x:_elem, in:address:list:_elem -> result:address:list:_elem [
   local-scope
   load-ingredients
-  result:address:list:_elem <- new {(list _elem): type}
+  result <- new {(list _elem): type}
   *result <- merge x, in
-  return result  # needed explicitly because we need to replace 'in' with 'result'
 ]
 
 def first in:address:list:_elem -> result:_elem [