표시 한 문자열의 대신 문자열의 목록을 표시이 5로 설정 회전 키를 바로 커먼 리스프에서 카이사르 암호입니다
나는 몇 가지 제한이
입력 여야가 읽기 및 재귀 적으로 목록으로 처리됩니다.
변수, 배열, 루프, progn이 허용되지 않습니다.
출력은 목록이 아닌 문자열이어야합니다.
프로그램은 재귀 만 사용해야합니다.
(defun encode (expr) ; define function funcName (argument)
; Out case when the list is empty
(cond ((null expr) nil) ; conditional (test1 action1)
; Checking if the expression is an atom only then to go encryption
((atom expr) (encrot expr)) ; test2 see if one or less atom
; Adding the result of encrot to the list and
(t(cons (encode(car expr)) (encode(cdr expr)))))) ; will run if all others fail
(defun encrot (expr)
; casts the object and then shifts the char by 5
(string (int-char(encrot2 (+ 5 (char-int(char (string expr) 0)))))))
(defun encrot2 (x)
; Checking to see if the atom is a letter
(cond ((> x 90) (+ 64 (mod x 90)))
((< x 91) x)))
내 이해 함수 양론 문자열로서리스트의 요소를 표시하는 점이다. 예 : ("A" "B" "C")
문자열은 이론적으로는 "A B C"
과 같아야합니다.
GNU CLISP 2.49 (2010-07-07) http://clisp.cons.org/을 사용하여 컴파일합니다.
는 (입력 + 출력) 예를 들어 줄 수 있을까? – coredump
'cons'가 아무것도 표시하지 않습니다. 어떤 결과물도 출력하지 않습니다. '단점'은 단점 셀을 구성하는 것입니다. –