retroforth/example/rot13.forth
crc cecfc111ba add rot13 example
FossilOrigin-Name: 3b74270fff52b849a6f26f659f6b3c14721b2a6fb905b128934e9d7df4b975e4
2017-10-20 03:41:10 +00:00

6 lines
151 B
Forth

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