케빈 TV
-
Lisp 비교 : 암호 문자열 감추기 문제 풀이Programmer/Programming 2016. 1. 13. 18:53
"케빈 TV 12회 (상) - 느 언어엔 이런거 없지?"에 주어진 글자수만큼 '*'를 가진 문자열을 생성하는 문제가 나왔다. 여러 언어별 구현이 나왔지만, Common Lisp와 Emacs Lisp, Scheme, Clojure가 없어서 여기에 적어본다. Common Lisp: (defun hide-password (passwd) (coerce (mapcar #'(lambda (x) #\*) (coerce passwd 'list)) 'string)) Emacs Lisp: (defun hide-password (passwd) (coerce (mapcar (lambda (x) ?\*) (coerce passwd 'list)) 'string)) Scheme: (define (hide-password passw..