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 12:47:18 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-05-20 12:47:18 -0700
commit7890b8cef2c330ad69e2ce5861931ff2768d6194 (patch)
treedece9d61de1f713d074e57869d248931869b2dac /074list.mu
parent02d8601c90bfb2a90328e57668ae7d53d5f4cfc1 (diff)
downloadmu-7890b8cef2c330ad69e2ce5861931ff2768d6194.tar.gz
2986 - new example: the 8-queens problem
Just playing around with edit/ and trying to find bugs.
Diffstat (limited to '074list.mu')
-rw-r--r--074list.mu9
1 files changed, 9 insertions, 0 deletions
diff --git a/074list.mu b/074list.mu
index 5244deec..79fed038 100644
--- a/074list.mu
+++ b/074list.mu
@@ -47,6 +47,15 @@ scenario list-handling [
   ]
 ]
 
+def length l:address:list:_elem -> result:number [
+  local-scope
+  load-ingredients
+  return-unless l, 0
+  rest:address:list:_elem <- rest l
+  length-of-rest:number <- length rest
+  result <- add length-of-rest, 1
+]
+
 def to-text in:address:list:_elem -> result:address:array:character [
   local-scope
   load-ingredients