diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-03-12 00:08:41 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-03-12 00:08:41 -0800 |
commit | 9bf79d64d322d0b11facf04a4fbda0548c17e1c3 (patch) | |
tree | b277e8884e11246a792b4eff96de10ad7f457f23 | |
parent | a445f8f1aab68a9665673af839e109dc277d43f4 (diff) | |
download | mu-9bf79d64d322d0b11facf04a4fbda0548c17e1c3.tar.gz |
3787
-rw-r--r-- | 061text.mu | 12 | ||||
-rw-r--r-- | html/061text.mu.html | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/061text.mu b/061text.mu index fac5609c..770d74fc 100644 --- a/061text.mu +++ b/061text.mu @@ -5,9 +5,9 @@ def equal a:text, b:text -> result:bool [ load-ingredients an:num, bn:num <- copy a, b address-equal?:boolean <- equal an, bn - reply-if address-equal?, 1/true - reply-unless a, 0/false - reply-unless b, 0/false + return-if address-equal?, 1/true + return-unless a, 0/false + return-unless b, 0/false a-len:num <- length *a b-len:num <- length *b # compare lengths @@ -1348,7 +1348,7 @@ def parse-whole-number in:text -> out:num, error?:bool [ c:char <- index *in, i x:num <- character-to-code c digit:num, error?:bool <- character-code-to-digit x - reply-if error? + return-if error? result <- multiply result, 10 result <- add result, digit i <- add i, 1 @@ -1364,9 +1364,9 @@ recipe character-code-to-digit character-code:number -> result:number, error?:bo load-ingredients result <- copy 0 error? <- lesser-than character-code, 48 # '0' - reply-if error? + return-if error? error? <- greater-than character-code, 57 # '9' - reply-if error? + return-if error? result <- subtract character-code, 48 ] diff --git a/html/061text.mu.html b/html/061text.mu.html index 82032cc6..1d6a67d9 100644 --- a/html/061text.mu.html +++ b/html/061text.mu.html @@ -67,9 +67,9 @@ if ('onhashchange' in window) { <span id="L5" class="LineNr"> 5 </span> <span class="Constant">load-ingredients</span> <span id="L6" class="LineNr"> 6 </span> an:num, bn:num <span class="Special"><-</span> copy a, b <span id="L7" class="LineNr"> 7 </span> address-equal?:boolean <span class="Special"><-</span> equal an, bn -<span id="L8" class="LineNr"> 8 </span> <span class="muControl">reply-if</span> address-equal?, <span class="Constant">1/true</span> -<span id="L9" class="LineNr"> 9 </span> <span class="muControl">reply-unless</span> a, <span class="Constant">0/false</span> -<span id="L10" class="LineNr"> 10 </span> <span class="muControl">reply-unless</span> b, <span class="Constant">0/false</span> +<span id="L8" class="LineNr"> 8 </span> <span class="muControl">return-if</span> address-equal?, <span class="Constant">1/true</span> +<span id="L9" class="LineNr"> 9 </span> <span class="muControl">return-unless</span> a, <span class="Constant">0/false</span> +<span id="L10" class="LineNr"> 10 </span> <span class="muControl">return-unless</span> b, <span class="Constant">0/false</span> <span id="L11" class="LineNr"> 11 </span> a-len:num <span class="Special"><-</span> length *a <span id="L12" class="LineNr"> 12 </span> b-len:num <span class="Special"><-</span> length *b <span id="L13" class="LineNr"> 13 </span> <span class="Comment"># compare lengths</span> @@ -1410,7 +1410,7 @@ if ('onhashchange' in window) { <span id="L1348" class="LineNr">1348 </span> <span class="Conceal">¦</span> c:char <span class="Special"><-</span> index *in, i <span id="L1349" class="LineNr">1349 </span> <span class="Conceal">¦</span> x:num <span class="Special"><-</span> character-to-code c <span id="L1350" class="LineNr">1350 </span> <span class="Conceal">¦</span> digit:num, error?:bool <span class="Special"><-</span> <a href='061text.mu.html#L1362'>character-code-to-digit</a> x -<span id="L1351" class="LineNr">1351 </span> <span class="Conceal">¦</span> <span class="muControl">reply-if</span> error? +<span id="L1351" class="LineNr">1351 </span> <span class="Conceal">¦</span> <span class="muControl">return-if</span> error? <span id="L1352" class="LineNr">1352 </span> <span class="Conceal">¦</span> result <span class="Special"><-</span> multiply result,<span class="Constant"> 10</span> <span id="L1353" class="LineNr">1353 </span> <span class="Conceal">¦</span> result <span class="Special"><-</span> add result, digit <span id="L1354" class="LineNr">1354 </span> <span class="Conceal">¦</span> i <span class="Special"><-</span> add i,<span class="Constant"> 1</span> @@ -1426,9 +1426,9 @@ if ('onhashchange' in window) { <span id="L1364" class="LineNr">1364 </span> <span class="Constant">load-ingredients</span> <span id="L1365" class="LineNr">1365 </span> result <span class="Special"><-</span> copy<span class="Constant"> 0</span> <span id="L1366" class="LineNr">1366 </span> error? <span class="Special"><-</span> lesser-than character-code,<span class="Constant"> 48</span> <span class="Comment"># '0'</span> -<span id="L1367" class="LineNr">1367 </span> <span class="muControl">reply-if</span> error? +<span id="L1367" class="LineNr">1367 </span> <span class="muControl">return-if</span> error? <span id="L1368" class="LineNr">1368 </span> error? <span class="Special"><-</span> greater-than character-code,<span class="Constant"> 57</span> <span class="Comment"># '9'</span> -<span id="L1369" class="LineNr">1369 </span> <span class="muControl">reply-if</span> error? +<span id="L1369" class="LineNr">1369 </span> <span class="muControl">return-if</span> error? <span id="L1370" class="LineNr">1370 </span> result <span class="Special"><-</span> subtract character-code,<span class="Constant"> 48</span> <span id="L1371" class="LineNr">1371 </span>] <span id="L1372" class="LineNr">1372 </span> |