diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-11-10 10:24:14 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-11-10 10:24:14 -0800 |
commit | f116818c7c6e98a5d9bfa7058096b42df85d8e1c (patch) | |
tree | ba3458a0c51f67c27c7347b1c5f5be2fc33965e2 /lambda-to-mu.mu | |
parent | b771d375d3e11dcf3e6e55175f2ae128448177a7 (diff) | |
download | mu-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 'lambda-to-mu.mu')
-rw-r--r-- | lambda-to-mu.mu | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/lambda-to-mu.mu b/lambda-to-mu.mu index c1c3171f..ef9886e3 100644 --- a/lambda-to-mu.mu +++ b/lambda-to-mu.mu @@ -50,14 +50,14 @@ def new-pair a:&:cell, b:&:cell -> result:&:cell [ def is-atom? x:&:cell -> result:bool [ local-scope load-ingredients - reply-unless x, 0/false + return-unless x, 0/false _, result <- maybe-convert *x, atom:variant ] def is-pair? x:&:cell -> result:bool [ local-scope load-ingredients - reply-unless x, 0/false + return-unless x, 0/false _, result <- maybe-convert *x, pair:variant ] @@ -91,7 +91,7 @@ def atom-match? x:&:cell, pat:text -> result:bool [ local-scope load-ingredients s:text, is-atom?:bool <- maybe-convert *x, atom:variant - reply-unless is-atom?, 0/false + return-unless is-atom?, 0/false result <- equal pat, s ] @@ -108,7 +108,7 @@ def first x:&:cell -> result:&:cell [ local-scope load-ingredients pair:pair, pair?:bool <- maybe-convert *x, pair:variant - reply-unless pair?, 0/nil + return-unless pair?, 0/nil result <- get pair, first:offset ] @@ -116,7 +116,7 @@ def rest x:&:cell -> result:&:cell [ local-scope load-ingredients pair:pair, pair?:bool <- maybe-convert *x, pair:variant - reply-unless pair?, 0/nil + return-unless pair?, 0/nil result <- get pair, rest:offset ] @@ -124,7 +124,7 @@ def set-first base:&:cell, new-first:&:cell -> base:&:cell [ local-scope load-ingredients pair:pair, is-pair?:bool <- maybe-convert *base, pair:variant - reply-unless is-pair? + return-unless is-pair? pair <- put pair, first:offset, new-first *base <- merge 1/pair, pair ] @@ -133,7 +133,7 @@ def set-rest base:&:cell, new-rest:&:cell -> base:&:cell [ local-scope load-ingredients pair:pair, is-pair?:bool <- maybe-convert *base, pair:variant - reply-unless is-pair? + return-unless is-pair? pair <- put pair, rest:offset, new-rest *base <- merge 1/pair, pair ] @@ -181,7 +181,7 @@ def parse in:&:stream:char -> out:&:cell, in:&:stream:char [ # skip whitespace in <- skip-whitespace in c:char, eof?:bool <- peek in - reply-if eof?, 0/nil + return-if eof?, 0/nil pair?:bool <- equal c, 40/open-paren { break-if pair? @@ -270,7 +270,7 @@ def skip-whitespace in:&:stream:char -> in:&:stream:char [ load-ingredients { done?:bool <- end-of-stream? in - reply-if done?, 0/null + return-if done?, 0/null c:char <- peek in space?:bool <- space? c break-unless space? @@ -294,14 +294,14 @@ def to-buffer x:&:cell, buf:&:buffer -> buf:&:buffer [ { break-if x buf <- append buf, [<>] - reply + return } # base case: atom { s:text, atom?:bool <- maybe-convert *x, atom:variant break-unless atom? buf <- append buf, s - reply + return } # recursive case: pair buf <- append buf, [< ] |