Sha256: 8ca1d6c5b07806b723b7f71613999f21daa61b81f478a0b866d9fca85975b5d0
Contents?: true
Size: 638 Bytes
Versions: 50
Compression:
Stored size: 638 Bytes
Contents
;;; bob.el --- Bob exercise (exercism) ;;; Commentary: ;;; Code: (defun response-for (phrase) "Provides Bob's response to PHRASE." (cond ((shoutp phrase) "Whoa, chill out!") ((string-match-p "^[[:space:]]*$" phrase) "Fine. Be that way!") ((questionp phrase) "Sure.") (t "Whatever."))) (defun shoutp (phrase) "Determines if PHRASE is shouted." (and (string-match "[A-Z]" phrase) (string= (upcase phrase) phrase))) (defun questionp (phrase) "Determines if PHRASE is a question." (and (> (length phrase) 0) (= ?? (aref phrase (1- (length phrase)))))) (provide 'bob) ;;; bob.el ends here
Version data entries
50 entries across 50 versions & 1 rubygems