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

Version Path
trackler-2.2.1.137 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.136 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.135 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.134 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.133 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.132 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.131 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.130 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.129 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.128 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.127 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.126 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.125 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.124 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.123 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.122 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.121 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.120 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.119 tracks/elisp/exercises/bob/example.el
trackler-2.2.1.118 tracks/elisp/exercises/bob/example.el