Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Caesar-cipher/TXR/caesar-cipher.txr
Normal file
23
Task/Caesar-cipher/TXR/caesar-cipher.txr
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
@(next :args)
|
||||
@(cases)
|
||||
@{key /[0-9]+/}
|
||||
@text
|
||||
@(or)
|
||||
@ (throw error "specify <key-num> <text>")
|
||||
@(end)
|
||||
@(do
|
||||
(defvar k (int-str key 10)))
|
||||
@(bind enc-dec
|
||||
@(collect-each ((i (range 0 25)))
|
||||
(let* ((p (tostringp (+ #\a i)))
|
||||
(e (tostringp (+ #\a (mod (+ i k) 26))))
|
||||
(P (upcase-str p))
|
||||
(E (upcase-str e)))
|
||||
^(((,p ,e) (,P ,E))
|
||||
((,e ,p) (,E ,P))))))
|
||||
@(deffilter enc . @(mappend (fun first) enc-dec))
|
||||
@(deffilter dec . @(mappend (fun second) enc-dec))
|
||||
@(output)
|
||||
encoded: @{text :filter enc}
|
||||
decoded: @{text :filter dec}
|
||||
@(end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue