diff --git a/util.lisp b/util.lisp index 68b0d29..c50e0ce 100644 --- a/util.lisp +++ b/util.lisp @@ -149,6 +149,12 @@ ((or (symbolp x) (characterp x)) (string x)) (t (format NIL "~S" x)))) +(defun leading-vowel (noun) + "Return noun prepended with 'a' or 'an', depending on its first letter." + (format NIL "~A ~A" + (if (member (char noun 0) '(#\a #\e #\i #\o #\u)) "an" "a") + noun)) + (defun extract-elements (str) "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" (multiple-value-bind (next-element i) (read-from-string str nil) diff --git a/util.lisp b/util.lisp index 68b0d29..c50e0ce 100644 --- a/util.lisp +++ b/util.lisp @@ -149,6 +149,12 @@ ((or (symbolp x) (characterp x)) (string x)) (t (format NIL "~S" x)))) +(defun leading-vowel (noun) + "Return noun prepended with 'a' or 'an', depending on its first letter." + (format NIL "~A ~A" + (if (member (char noun 0) '(#\a #\e #\i #\o #\u)) "an" "a") + noun)) + (defun extract-elements (str) "Extract all Lisp elements (strings, symbols, numbers, etc.) from str" (multiple-value-bind (next-element i) (read-from-string str nil) diff --git a/world.lisp b/world.lisp index 51db293..b591133 100644 --- a/world.lisp +++ b/world.lisp @@ -185,8 +185,9 @@ (format NIL "~A / ~A" (first (patch-pos p)) (second (patch-pos p))) "" (format NIL "The ground here is ~A." (biome-ground (patch-biome p))) (when (patch-occupant p) - (format NIL "There is a ~A here." (.name (patch-occupant p)))) + (format NIL "There is ~A here." + (leading-vowel (.name (patch-occupant p))))) (when (patch-items p) ;;FIXME we will be dealing with instances here, not names... (format NIL "The following items are here:~A *~A" #\newline - (string-from-list (patch-items p) (format NIL "~% *")))))) + (string-from-list (patch-items p) (format NIL "~% *"))))))