;;; File:
;;;   pirate.ss
;;; Authors:
;;;   Samuel A. Rebelsky
;;;   YOUR NAME HERE
;;; Version:
;;;   0.1 of September 2003
;;; Summary:
;;;   A few related procedures for "piratizing" text.
;;; Contents:
;;;   (piratize-word str)
;;;     Convert an individual word to pirate-speak.
;;;   (piratize str)
;;;     Convert a longer phrase to pirate-speak.
;;; History:
;;;   At end

(load "/home/rebelsky/Web/Scheme/slams.ss")

;;; Procedure:
;;;   piratize-word
;;; Parameters:
;;;   word, a string
;;; Purpose:
;;;   Convert the word to "pirate speak"
;;; Produces:
;;;   new-word, a string
;;; Preconditions:
;;;   [Standard]
;;; Postconditions:
;;;   new-word is a word a pirate might use in place of word.
;;; Problems:
;;;   Somewhat limited right now.
(define piratize-word
  (lambda (word)
    (cond
      ((string=? word "Hello") "Ahoy")
      ((string=? word "Yes") "Aye")
      ((string=? word "yes") "aye")
      ((string=? word "man") "bilge-rat")
      ((string=? word "to") "t'")
      (else word))))

;;; Procedure:
;;;   piratize
;;; Parameters:
;;;   phrase, a string
;;; Purpose:
;;;   To convert phrase to pirate-speak.
;;; Produces:
;;;   new-phrase, a string
;;; Preconditions:
;;;   [None]
;;; Postconditions:
;;;   new-phrase is a phrase a pirate might reasonably say rather than
;;;     using the "landlubber speak" of phrase.
;;; Problems:
;;;   Still fairly primitive.
(define piratize
  (lambda (str)
    (join (map piratize-word (split str)))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; History ;;;
;;;;;;;;;;;;;;;

;;; V0.1 - Friday, 19 September 2003 [Samuel A. Rebelsky]
;;; * Created.

