about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-07-24 15:58:26 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-07-24 15:58:26 -0700
commite81420e6a4f0b13122938db7e137151ca88b96eb (patch)
tree82ee542cf529f41f688cb9b52d4e04035aea1b21
parent301a6fb1cac67768cbdca6def6bfef149652f274 (diff)
downloadmu-e81420e6a4f0b13122938db7e137151ca88b96eb.tar.gz
3148
-rw-r--r--lambda-to-mu.mu17
1 files changed, 17 insertions, 0 deletions
diff --git a/lambda-to-mu.mu b/lambda-to-mu.mu
index da33a358..e09a078f 100644
--- a/lambda-to-mu.mu
+++ b/lambda-to-mu.mu
@@ -87,6 +87,23 @@ scenario pair-is-not-atom [
   ]
 ]
 
+def atom-match? x:address:cell, pat:address:array:character -> result:boolean [
+  local-scope
+  load-ingredients
+  s:address:array:character, is-atom?:boolean <- maybe-convert *x, atom:variant
+  reply-unless is-atom?, 0/false
+  result <- equal pat, s
+]
+
+scenario atom-match [
+  local-scope
+  x:address:cell <- new-atom [abc]
+  10:boolean/raw <- atom-match? x, [abc]
+  memory-should-contain [
+    10 <- 1
+  ]
+]
+
 def first x:address:cell -> result:address:cell [
   local-scope
   load-ingredients