Skip to content

Instantly share code, notes, and snippets.

@lucca65
Created December 16, 2015 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lucca65/fa7f72fd230b154fdc48 to your computer and use it in GitHub Desktop.
Save lucca65/fa7f72fd230b154fdc48 to your computer and use it in GitHub Desktop.
(defun safadao ()
(interactive) ;; interactive interpreter
(let (birthdate) ;; create variable birthdate, it will be avaliable for nested stuff
(progn (setq birthdate (read-no-blanks-input "digite sua data de nascimento: "))) ;; set birthdate to whatever user inputs
(if (and (< 7 (length birthdate))
(> 9 (length birthdate)))
(let ((sum 0) list day month year safadeza)
(progn
(setq list (split-string birthdate "/"))
(setq day (string-to-int (nth 0 list)))
(setq month (string-to-int (nth 1 list)))
(setq year (string-to-int (nth 2 list)))
(while (> month 0)
(setq sum (+ sum month))
(setq month (1- month)))
(setq safadeza (+ sum (* (/ year 100.0) (- 50 day))))
(message (format "voce é %s safado e %s anjo." safadeza (-100 safadeza)))
)
)
(message "por favor, digite o formato certo, animal")
)
)
)
(safadao)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment