Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
16
Task/Caesar-cipher/XLISP/caesar-cipher-1.xlisp
Normal file
16
Task/Caesar-cipher/XLISP/caesar-cipher-1.xlisp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
(defun caesar-encode (text key)
|
||||
(defun encode (ascii-code)
|
||||
(defun rotate (character alphabet)
|
||||
(define code (+ character key))
|
||||
(cond
|
||||
((> code (+ alphabet 25)) (- code 26))
|
||||
((< code alphabet) (+ code 26))
|
||||
(t code)))
|
||||
(cond
|
||||
((and (>= ascii-code 65) (<= ascii-code 90)) (rotate ascii-code 65))
|
||||
((and (>= ascii-code 97) (<= ascii-code 122)) (rotate ascii-code 97))
|
||||
(t ascii-code)))
|
||||
(list->string (mapcar integer->char (mapcar encode (mapcar char->integer (string->list text))))))
|
||||
|
||||
(defun caesar-decode (text key)
|
||||
(caesar-encode text (- 26 key)))
|
||||
9
Task/Caesar-cipher/XLISP/caesar-cipher-2.xlisp
Normal file
9
Task/Caesar-cipher/XLISP/caesar-cipher-2.xlisp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
[1] (define caesar-test (caesar-encode "CAESAR: Who is it in the press that calls on me? I hear a tongue, shriller than all the music, Cry 'Caesar!' Speak; Caesar is turn'd to hear." 14))
|
||||
|
||||
CAESAR-TEST
|
||||
[2] caesar-test
|
||||
|
||||
"QOSGOF: Kvc wg wh wb hvs dfsgg hvoh qozzg cb as? W vsof o hcbuis, gvfwzzsf hvob ozz hvs aigwq, Qfm 'Qosgof!' Gdsoy; Qosgof wg hifb'r hc vsof."
|
||||
[3] (caesar-decode caesar-test 14)
|
||||
|
||||
"CAESAR: Who is it in the press that calls on me? I hear a tongue, shriller than all the music, Cry 'Caesar!' Speak; Caesar is turn'd to hear."
|
||||
Loading…
Add table
Add a link
Reference in a new issue