about summary refs log tree commit diff stats
path: root/lambda-to-mu.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-10-08 10:52:58 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-10-08 10:53:06 -0700
commit9458918f9eb88817e6b58e6e475597f8d60ecc40 (patch)
treee24a56839615ea24524022047bfe65ba9f346928 /lambda-to-mu.mu
parent0d6630f075ee80a3339451eff573d3ac748b7d60 (diff)
downloadmu-9458918f9eb88817e6b58e6e475597f8d60ecc40.tar.gz
3483
Diffstat (limited to 'lambda-to-mu.mu')
-rw-r--r--lambda-to-mu.mu120
1 files changed, 60 insertions, 60 deletions
diff --git a/lambda-to-mu.mu b/lambda-to-mu.mu
index 0bdeb43f..d7220b1d 100644
--- a/lambda-to-mu.mu
+++ b/lambda-to-mu.mu
@@ -47,14 +47,14 @@ def new-pair a:&:cell, b:&:cell -> result:&:cell [
   *result <- merge 1/tag:pair, a/first, b/rest
 ]
 
-def is-atom? x:&:cell -> result:boolean [
+def is-atom? x:&:cell -> result:bool [
   local-scope
   load-ingredients
   reply-unless x, 0/false
   _, result <- maybe-convert *x, atom:variant
 ]
 
-def is-pair? x:&:cell -> result:boolean [
+def is-pair? x:&:cell -> result:bool [
   local-scope
   load-ingredients
   reply-unless x, 0/false
@@ -65,8 +65,8 @@ scenario atom-is-not-pair [
   local-scope
   s:text <- new [a]
   x:&:cell <- new-atom s
-  10:boolean/raw <- is-atom? x
-  11:boolean/raw <- is-pair? x
+  10:bool/raw <- is-atom? x
+  11:bool/raw <- is-pair? x
   memory-should-contain [
     10 <- 1
     11 <- 0
@@ -79,18 +79,18 @@ scenario pair-is-not-atom [
   s:text <- new [a]
   x:&:cell <- new-atom s
   y:&:cell <- new-pair x, 0/nil
-  10:boolean/raw <- is-atom? y
-  11:boolean/raw <- is-pair? y
+  10:bool/raw <- is-atom? y
+  11:bool/raw <- is-pair? y
   memory-should-contain [
     10 <- 0
     11 <- 1
   ]
 ]
 
-def atom-match? x:&:cell, pat:text -> result:boolean [
+def atom-match? x:&:cell, pat:text -> result:bool [
   local-scope
   load-ingredients
-  s:text, is-atom?:boolean <- maybe-convert *x, atom:variant
+  s:text, is-atom?:bool <- maybe-convert *x, atom:variant
   reply-unless is-atom?, 0/false
   result <- equal pat, s
 ]
@@ -98,7 +98,7 @@ def atom-match? x:&:cell, pat:text -> result:boolean [
 scenario atom-match [
   local-scope
   x:&:cell <- new-atom [abc]
-  10:boolean/raw <- atom-match? x, [abc]
+  10:bool/raw <- atom-match? x, [abc]
   memory-should-contain [
     10 <- 1
   ]
@@ -107,7 +107,7 @@ scenario atom-match [
 def first x:&:cell -> result:&:cell [
   local-scope
   load-ingredients
-  pair:pair, pair?:boolean <- maybe-convert *x, pair:variant
+  pair:pair, pair?:bool <- maybe-convert *x, pair:variant
   reply-unless pair?, 0/nil
   result <- get pair, first:offset
 ]
@@ -115,7 +115,7 @@ def first x:&:cell -> result:&:cell [
 def rest x:&:cell -> result:&:cell [
   local-scope
   load-ingredients
-  pair:pair, pair?:boolean <- maybe-convert *x, pair:variant
+  pair:pair, pair?:bool <- maybe-convert *x, pair:variant
   reply-unless pair?, 0/nil
   result <- get pair, rest:offset
 ]
@@ -123,7 +123,7 @@ def rest x:&:cell -> result:&:cell [
 def set-first base:&:cell, new-first:&:cell -> base:&:cell [
   local-scope
   load-ingredients
-  pair:pair, is-pair?:boolean <- maybe-convert *base, pair:variant
+  pair:pair, is-pair?:bool <- maybe-convert *base, pair:variant
   reply-unless is-pair?
   pair <- put pair, first:offset, new-first
   *base <- merge 1/pair, pair
@@ -132,7 +132,7 @@ def set-first base:&:cell, new-first:&:cell -> base:&:cell [
 def set-rest base:&:cell, new-rest:&:cell -> base:&:cell [
   local-scope
   load-ingredients
-  pair:pair, is-pair?:boolean <- maybe-convert *base, pair:variant
+  pair:pair, is-pair?:bool <- maybe-convert *base, pair:variant
   reply-unless is-pair?
   pair <- put pair, rest:offset, new-rest
   *base <- merge 1/pair, pair
@@ -157,7 +157,7 @@ scenario cell-operations-on-pair [
   x:&:cell <- new-atom s
   y:&:cell <- new-pair x, 0/nil
   x2:&:cell <- first y
-  10:boolean/raw <- equal x, x2
+  10:bool/raw <- equal x, x2
   11:&:cell/raw <- rest y
   memory-should-contain [
     10 <- 1  # first is correct
@@ -180,15 +180,15 @@ def parse in:&:stream:char -> out:&:cell, in:&:stream:char [
   load-ingredients
   # skip whitespace
   in <- skip-whitespace in
-  c:char, eof?:boolean <- peek in
+  c:char, eof?:bool <- peek in
   reply-if eof?, 0/nil
-  pair?:boolean <- equal c, 40/open-paren
+  pair?:bool <- equal c, 40/open-paren
   {
     break-if pair?
     # atom
     b:&:buffer <- new-buffer 30
     {
-      done?:boolean <- end-of-stream? in
+      done?:bool <- end-of-stream? in
       break-if done?
       # stop before close paren or space
       c:char <- peek in
@@ -210,11 +210,11 @@ def parse in:&:stream:char -> out:&:cell, in:&:stream:char [
     out <- new cell:type  # start out with nil
     # read in first element of pair
     {
-      end?:boolean <- end-of-stream? in
-      not-end?:boolean <- not end?
+      end?:bool <- end-of-stream? in
+      not-end?:bool <- not end?
       assert not-end?, [unbalanced '(' in expression]
       c <- peek in
-      close-paren?:boolean <- equal c, 41/close-paren
+      close-paren?:bool <- equal c, 41/close-paren
       break-if close-paren?
       first:&:cell, in <- parse in
       *out <- merge 1/pair, first, 0/nil
@@ -223,20 +223,20 @@ def parse in:&:stream:char -> out:&:cell, in:&:stream:char [
     curr:&:cell <- copy out
     {
       in <- skip-whitespace in
-      end?:boolean <- end-of-stream? in
-      not-end?:boolean <- not end?
+      end?:bool <- end-of-stream? in
+      not-end?:bool <- not end?
       assert not-end?, [unbalanced '(' in expression]
       # termination check: ')'
       c <- peek in
       {
-        close-paren?:boolean <- equal c, 41/close-paren
+        close-paren?:bool <- equal c, 41/close-paren
         break-unless close-paren?
         read in  # skip ')'
         break +end-pair:label
       }
       # still here? read next element of pair
       next:&:cell, in <- parse in
-      is-dot?:boolean <- atom-match? next, [.]
+      is-dot?:bool <- atom-match? next, [.]
       {
         break-if is-dot?
         next-curr:&:cell <- new-pair next, 0/nil
@@ -248,7 +248,7 @@ def parse in:&:stream:char -> out:&:cell, in:&:stream:char [
         # deal with dotted pair
         in <- skip-whitespace in
         c <- peek in
-        not-close-paren?:boolean <- not-equal c, 41/close-paren
+        not-close-paren?:bool <- not-equal c, 41/close-paren
         assert not-close-paren?, [')' cannot immediately follow '.']
         final:&:cell <- parse in
         curr <- set-rest curr, final
@@ -256,7 +256,7 @@ def parse in:&:stream:char -> out:&:cell, in:&:stream:char [
         # is going to end the pair
         in <- skip-whitespace in
         c <- peek in
-        close-paren?:boolean <- equal c, 41/close-paren
+        close-paren?:bool <- equal c, 41/close-paren
         assert close-paren?, ['.' must be followed by exactly one expression before ')']
       }
       loop
@@ -269,10 +269,10 @@ def skip-whitespace in:&:stream:char -> in:&:stream:char [
   local-scope
   load-ingredients
   {
-    done?:boolean <- end-of-stream? in
+    done?:bool <- end-of-stream? in
     reply-if done?, 0/null
     c:char <- peek in
-    space?:boolean <- space? c
+    space?:bool <- space? c
     break-unless space?
     read in  # skip
     loop
@@ -298,7 +298,7 @@ def to-buffer x:&:cell, buf:&:buffer -> buf:&:buffer [
   }
   # base case: atom
   {
-    s:text, atom?:boolean <- maybe-convert *x, atom:variant
+    s:text, atom?:bool <- maybe-convert *x, atom:variant
     break-unless atom?
     buf <- append buf, s
     reply
@@ -317,7 +317,7 @@ scenario parse-single-letter-atom [
   local-scope
   s:text <- new [a]
   x:&:cell <- parse s
-  s2:text, 10:boolean/raw <- maybe-convert *x, atom:variant
+  s2:text, 10:bool/raw <- maybe-convert *x, atom:variant
   11:@:char/raw <- copy *s2
   memory-should-contain [
     10 <- 1  # parse result is an atom
@@ -329,7 +329,7 @@ scenario parse-atom [
   local-scope
   s:text <- new [abc]
   x:&:cell <- parse s
-  s2:text, 10:boolean/raw <- maybe-convert *x, atom:variant
+  s2:text, 10:bool/raw <- maybe-convert *x, atom:variant
   11:@:char/raw <- copy *s2
   memory-should-contain [
     10 <- 1  # parse result is an atom
@@ -344,13 +344,13 @@ scenario parse-list-of-two-atoms [
   trace-should-contain [
     app/parse: < abc | < def | <> > >
   ]
-  10:boolean/raw <- is-pair? x
+  10:bool/raw <- is-pair? x
   x1:&:cell <- first x
   x2:&:cell <- rest x
-  s1:text, 11:boolean/raw <- maybe-convert *x1, atom:variant
-  12:boolean/raw <- is-pair? x2
+  s1:text, 11:bool/raw <- maybe-convert *x1, atom:variant
+  12:bool/raw <- is-pair? x2
   x3:&:cell <- first x2
-  s2:text, 13:boolean/raw <- maybe-convert *x3, atom:variant
+  s2:text, 13:bool/raw <- maybe-convert *x3, atom:variant
   14:&:cell/raw <- rest x2
   20:@:char/raw <- copy *s1
   30:@:char/raw <- copy *s2
@@ -372,13 +372,13 @@ scenario parse-list-with-extra-spaces [
   trace-should-contain [
     app/parse: < abc | < def | <> > >
   ]
-  10:boolean/raw <- is-pair? x
+  10:bool/raw <- is-pair? x
   x1:&:cell <- first x
   x2:&:cell <- rest x
-  s1:text, 11:boolean/raw <- maybe-convert *x1, atom:variant
-  12:boolean/raw <- is-pair? x2
+  s1:text, 11:bool/raw <- maybe-convert *x1, atom:variant
+  12:bool/raw <- is-pair? x2
   x3:&:cell <- first x2
-  s2:text, 13:boolean/raw <- maybe-convert *x3, atom:variant
+  s2:text, 13:bool/raw <- maybe-convert *x3, atom:variant
   14:&:cell/raw <- rest x2
   20:@:char/raw <- copy *s1
   30:@:char/raw <- copy *s2
@@ -400,17 +400,17 @@ scenario parse-list-of-more-than-two-atoms [
   trace-should-contain [
     app/parse: < abc | < def | < ghi | <> > > >
   ]
-  10:boolean/raw <- is-pair? x
+  10:bool/raw <- is-pair? x
   x1:&:cell <- first x
   x2:&:cell <- rest x
-  s1:text, 11:boolean/raw <- maybe-convert *x1, atom:variant
-  12:boolean/raw <- is-pair? x2
+  s1:text, 11:bool/raw <- maybe-convert *x1, atom:variant
+  12:bool/raw <- is-pair? x2
   x3:&:cell <- first x2
-  s2:text, 13:boolean/raw <- maybe-convert *x3, atom:variant
+  s2:text, 13:bool/raw <- maybe-convert *x3, atom:variant
   x4:&:cell <- rest x2
-  14:boolean/raw <- is-pair? x4
+  14:bool/raw <- is-pair? x4
   x5:&:cell <- first x4
-  s3:text, 15:boolean/raw <- maybe-convert *x5, atom:variant
+  s3:text, 15:bool/raw <- maybe-convert *x5, atom:variant
   16:&:cell/raw <- rest x4
   20:@:char/raw <- copy *s1
   30:@:char/raw <- copy *s2
@@ -436,11 +436,11 @@ scenario parse-nested-list [
   trace-should-contain [
     app/parse: < < abc | <> > | <> >
   ]
-  10:boolean/raw <- is-pair? x
+  10:bool/raw <- is-pair? x
   x1:&:cell <- first x
-  11:boolean/raw <- is-pair? x
+  11:bool/raw <- is-pair? x
   x2:&:cell <- first x1
-  s1:text, 12:boolean/raw <- maybe-convert *x2, atom:variant
+  s1:text, 12:bool/raw <- maybe-convert *x2, atom:variant
   13:&:cell/raw <- rest x1
   14:&:cell/raw <- rest x
   20:@:char/raw <- copy *s1
@@ -461,15 +461,15 @@ scenario parse-nested-list-2 [
   trace-should-contain [
     app/parse: < < abc | <> > | < def | <> > >
   ]
-  10:boolean/raw <- is-pair? x
+  10:bool/raw <- is-pair? x
   x1:&:cell <- first x
-  11:boolean/raw <- is-pair? x
+  11:bool/raw <- is-pair? x
   x2:&:cell <- first x1
-  s1:text, 12:boolean/raw <- maybe-convert *x2, atom:variant
+  s1:text, 12:bool/raw <- maybe-convert *x2, atom:variant
   13:&:cell/raw <- rest x1
   x3:&:cell <- rest x
   x4:&:cell <- first x3
-  s2:text, 14:boolean/raw <- maybe-convert *x4, atom:variant
+  s2:text, 14:bool/raw <- maybe-convert *x4, atom:variant
   15:&:cell/raw <- rest x3
   20:@:char/raw <- copy *s1
   30:@:char/raw <- copy *s2
@@ -516,11 +516,11 @@ scenario parse-dotted-list-of-two-atoms [
   trace-should-contain [
     app/parse: < abc | def >
   ]
-  10:boolean/raw <- is-pair? x
+  10:bool/raw <- is-pair? x
   x1:&:cell <- first x
   x2:&:cell <- rest x
-  s1:text, 11:boolean/raw <- maybe-convert *x1, atom:variant
-  s2:text, 12:boolean/raw <- maybe-convert *x2, atom:variant
+  s1:text, 11:bool/raw <- maybe-convert *x1, atom:variant
+  s2:text, 12:bool/raw <- maybe-convert *x2, atom:variant
   20:@:char/raw <- copy *s1
   30:@:char/raw <- copy *s2
   memory-should-contain [
@@ -540,15 +540,15 @@ scenario parse-dotted-list-of-more-than-two-atoms [
   trace-should-contain [
     app/parse: < abc | < def | ghi > >
   ]
-  10:boolean/raw <- is-pair? x
+  10:bool/raw <- is-pair? x
   x1:&:cell <- first x
   x2:&:cell <- rest x
-  s1:text, 11:boolean/raw <- maybe-convert *x1, atom:variant
-  12:boolean/raw <- is-pair? x2
+  s1:text, 11:bool/raw <- maybe-convert *x1, atom:variant
+  12:bool/raw <- is-pair? x2
   x3:&:cell <- first x2
-  s2:text, 13:boolean/raw <- maybe-convert *x3, atom:variant
+  s2:text, 13:bool/raw <- maybe-convert *x3, atom:variant
   x4:&:cell <- rest x2
-  s3:text, 14:boolean/raw <- maybe-convert *x4, atom:variant
+  s3:text, 14:bool/raw <- maybe-convert *x4, atom:variant
   20:@:char/raw <- copy *s1
   30:@:char/raw <- copy *s2
   40:@:char/raw <- copy *s3