about summary refs log tree commit diff stats
path: root/nqueens.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-11-10 10:24:14 -0800
committerKartik K. Agaram <vc@akkartik.com>2016-11-10 10:24:14 -0800
commitf116818c7c6e98a5d9bfa7058096b42df85d8e1c (patch)
treeba3458a0c51f67c27c7347b1c5f5be2fc33965e2 /nqueens.mu
parentb771d375d3e11dcf3e6e55175f2ae128448177a7 (diff)
downloadmu-f116818c7c6e98a5d9bfa7058096b42df85d8e1c.tar.gz
3656
Periodic cleanup to replace 'reply' with 'return' everywhere in the
repo.

I use 'reply' for students to help reinforce the metaphor of function
calls as being like messages through a pipe. But that causes 'reply' to
get into my muscle memory when writing Mu code for myself, and I worry
that that makes Mu seem unnecessarily alien to anybody reading on
Github.

Perhaps I should just give it up? I'll try using 'return' with my next
student.
Diffstat (limited to 'nqueens.mu')
-rw-r--r--nqueens.mu12
1 files changed, 6 insertions, 6 deletions
diff --git a/nqueens.mu b/nqueens.mu
index 083a9019..eb4f8493 100644
--- a/nqueens.mu
+++ b/nqueens.mu
@@ -49,9 +49,9 @@ def conflict? curr:square, queens:&:list:square -> result:bool [
   local-scope
   load-ingredients
   result1:bool <- conflicting-file? curr, queens
-  reply-if result1, result1
+  return-if result1, result1
   result2:bool <- conflicting-diagonal? curr, queens
-  reply result2
+  return result2
 ]
 
 def conflicting-file? curr:square, queens:&:list:square -> result:bool [
@@ -63,11 +63,11 @@ def conflicting-file? curr:square, queens:&:list:square -> result:bool [
     q:square <- first queens
     qfile:num <- get q, file:offset
     file-match?:bool <- equal curr-file, qfile
-    reply-if file-match?, 1/conflict-found
+    return-if file-match?, 1/conflict-found
     queens <- rest queens
     loop
   }
-  reply 0/no-conflict-found
+  return 0/no-conflict-found
 ]
 
 def conflicting-diagonal? curr:square, queens:&:list:square -> result:bool [
@@ -85,11 +85,11 @@ def conflicting-diagonal? curr:square, queens:&:list:square -> result:bool [
     rank-delta <- abs rank-delta
     file-delta <- abs file-delta
     diagonal-match?:bool <- equal rank-delta, file-delta
-    reply-if diagonal-match?, 1/conflict-found
+    return-if diagonal-match?, 1/conflict-found
     queens <- rest queens
     loop
   }
-  reply 0/no-conflict-found
+  return 0/no-conflict-found
 ]
 
 def main [