add rot13 example

FossilOrigin-Name: 3b74270fff52b849a6f26f659f6b3c14721b2a6fb905b128934e9d7df4b975e4
This commit is contained in:
crc 2017-10-20 03:41:10 +00:00
parent 320e100737
commit cecfc111ba
2 changed files with 7 additions and 0 deletions

View file

@ -24,3 +24,4 @@
| sort-on-stack.forth | Sort numbers on the stack |
| accumulator.forth | Sample use of `does` |
| Parse-UPS.forth | Break a UPS Tracking # apart |
| rot13.forth | ROT13 "encryption" |

6
example/rot13.forth Normal file
View file

@ -0,0 +1,6 @@
~~~
:MAP (-s) 'nopqrstuvwxyzabcdefghijklm ;
:encode (c-c) $a - MAP + fetch ;
:rot13 (s-s) s:to-lower [ dup c:letter? [ encode ] if ] s:map ;
~~~