Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
14
Task/Caesar-cipher/Retro/caesar-cipher.retro
Normal file
14
Task/Caesar-cipher/Retro/caesar-cipher.retro
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{{
|
||||
variable offset
|
||||
: rotate ( cb-c ) tuck - @offset + 26 mod + ;
|
||||
: rotate? ( c-c )
|
||||
dup 'a 'z within [ 'a rotate ] ifTrue
|
||||
dup 'A 'Z within [ 'A rotate ] ifTrue ;
|
||||
---reveal---
|
||||
: ceaser ( $n-$ )
|
||||
!offset dup [ [ @ rotate? ] sip ! ] ^types'STRING each@ ;
|
||||
}}
|
||||
|
||||
( Example )
|
||||
"THEYBROKEOURCIPHEREVERYONECANREADTHIS" 3 ceaser ( returns encrypted string )
|
||||
23 ceaser ( returns decrypted string )
|
||||
Loading…
Add table
Add a link
Reference in a new issue