about summary refs log tree commit diff stats
path: root/064list.mu
diff options
context:
space:
mode:
Diffstat (limited to '064list.mu')
-rw-r--r--064list.mu11
1 files changed, 7 insertions, 4 deletions
diff --git a/064list.mu b/064list.mu
index b09cca43..eb6e0dc9 100644
--- a/064list.mu
+++ b/064list.mu
@@ -52,10 +52,13 @@ scenario list-handling [
 def length l:&:list:_elem -> result:num [
   local-scope
   load-ingredients
-  return-unless l, 0
-  rest:&:list:_elem <- rest l
-  length-of-rest:num <- length rest
-  result <- add length-of-rest, 1
+  result <- copy 0
+  {
+    break-unless l
+    result <- add result, 1
+    l <- rest l
+    loop
+  }
 ]
 
 # insert 'x' after 'in'