diff --git a/challenges/2-palindromos/lisp/cherryramatisdev/model.md b/challenges/2-palindromos/lisp/cherryramatisdev/model.md new file mode 100644 index 00000000..82291b35 --- /dev/null +++ b/challenges/2-palindromos/lisp/cherryramatisdev/model.md @@ -0,0 +1,23 @@ +# Submissão de Exercício + +**Exercício:** 2 - Palíndromos + +**Nickname:** cherryramatisdev + +**Nível Técnico:** - Senior - + +**Empresa:** - He4rt - + +**Twitter**: + +**Dificuldade de Resolução:** - Baixa - + +**Comentários:** Consegui descobrir a existência da função `princ` que printa pro STDOUT sem as `""`. + +**Como rodar o desafio**: + +Use o comando abaixo: + +```bash +ros -Q palindromo.lisp +``` diff --git a/challenges/2-palindromos/lisp/cherryramatisdev/palindromo.lisp b/challenges/2-palindromos/lisp/cherryramatisdev/palindromo.lisp new file mode 100644 index 00000000..407c2603 --- /dev/null +++ b/challenges/2-palindromos/lisp/cherryramatisdev/palindromo.lisp @@ -0,0 +1,16 @@ +(defun palindromo? (word) + "Check if a given `word' is a palindrome" + (let* ((downcased-word (string-downcase word)) + (reversed-word (reverse downcased-word))) + (string-equal downcased-word reversed-word))) + +(defun print-palindromo (word) + "A function that use `'palindromo? but print the correct word to STDOUT" + (if (palindromo? word) + "true" + "false")) + +(defun main (&rest args) + (if (> (length args) 0) + (loop for arg in args do (print (print-palindromo arg))) + (princ (print-palindromo (read-line)))))