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-2.2.1.86 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.85 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.84 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.83 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.82 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.81 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.80 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.79 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.78 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.77 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.76 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.75 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.74 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.73 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.72 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.71 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.70 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.69 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.68 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.67 tracks/elisp/exercises/bob/example.el