Sha256: 91715dd14b450b4760fa50995f70d84d51c03a55877dec25f0f3c5d65674c383

Contents?: true

Size: 660 Bytes

Versions: 304

Compression:

Stored size: 660 Bytes

Contents

;;; bob.el --- Bob exercise (exercism)

;;; Commentary:

;;; Code:
(eval-when-compile (require 'subr-x))

(defun response-for (phrase)
  "Provides Bob's response to PHRASE."
  (cond ((shoutp phrase) "Whoa, chill out!")
        ((string-blank-p 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

304 entries across 304 versions & 1 rubygems

Version Path
trackler-1.0.1.1 tracks/elisp/exercises/bob/example.el
trackler-1.0.1.0 tracks/elisp/exercises/bob/example.el
trackler-1.0.0.1 tracks/elisp/exercises/bob/example.el
trackler-1.0.0 tracks/elisp/exercises/bob/example.el