Branch
Hash :
9c8911bd
Author :
Date :
2021-07-19T17:01:49
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|= [a=@ b=tape]
^- tape
?: (gth a 25)
$(a (sub a 26))
%+ turn b
|= c=@tD
?: &((gte c 'A') (lte c 'Z'))
=. c (add c a)
?. (gth c 'Z') c
(sub c 26)
?: &((gte c 'a') (lte c 'z'))
=. c (add c a)
?. (gth c 'z') c
(sub c 26)
c
----------------------------------------------------
[
["keyword", "|="],
" [",
["function", "a"],
"=",
["class-name", "@"],
["function", "b"],
"=",
["function", "tape"],
"]\r\n",
["keyword", "^-"],
["function", "tape"],
["keyword", "?:"],
" (",
["function", "gth"],
["function", "a"],
" 25)\r\n $(",
["function", "a"],
" (",
["function", "sub"],
["function", "a"],
" 26))\r\n",
["keyword", "%+"],
["function", "turn"],
["function", "b"],
["keyword", "|="],
["function", "c"],
"=",
["class-name", "@tD"],
["keyword", "?:"],
" &((",
["function", "gte"],
["function", "c"],
["string", "'A'"],
") (",
["function", "lte"],
["function", "c"],
["string", "'Z'"],
"))\r\n ",
["keyword", "=."],
["function", "c"],
" (",
["function", "add"],
["function", "c"],
["function", "a"],
")\r\n ",
["keyword", "?."],
" (",
["function", "gth"],
["function", "c"],
["string", "'Z'"],
") ",
["function", "c"],
"\r\n (",
["function", "sub"],
["function", "c"],
" 26)\r\n",
["keyword", "?:"],
" &((",
["function", "gte"],
["function", "c"],
["string", "'a'"],
") (",
["function", "lte"],
["function", "c"],
["string", "'z'"],
"))\r\n ",
["keyword", "=."],
["function", "c"],
" (",
["function", "add"],
["function", "c"],
["function", "a"],
")\r\n ",
["keyword", "?."],
" (",
["function", "gth"],
["function", "c"],
["string", "'z'"],
") ",
["function", "c"],
"\r\n (",
["function", "sub"],
["function", "c"],
" 26)\r\n",
["function", "c"]
]
----------------------------------------------------
Tests using the Caesar cipher to demonstrate multiple occasions of cords and tapes on the same line, correcting avoiding clobbering two cord and tape definitions into one.