Sonoma State University
Department of Computer Science
CS-460: Programming Languages
Exercise 12a

Objective:

Please enter the following Common Lisp program before answering the questions below:

(defun split-by-one-space (string)
"Returns a list of substrings of string divided by ONE space each. Note: Two consecutive spaces will be seen as if there were an empty string between them."
(loop for i = 0 then (1+ j)
as j = (position #\Space string :start i)
collect (subseq string i j)
while j))

In a team of three or four students, enter the output from the following Common Lisp statements:

  1. (search "the" "the quick brown fox jumps over the lazy dog")
  2. (search "the" "the quick brown fox jumps over the lazy dog" :from-end t)
  3. (search "THE" "the quick brown fox jumps over the lazy dog")
  4. (string-upcase "the quick brown fox jumps over the lazy dog")
  5. (string-downcase "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG")
  6. (string-capitalize "the quick brown fox jumps over the lazy dog")
  7. (string= "fox" "dog")
  8. (string= "dog" "Dog")
  9. (split-by-one-space "the quick brown fox jumps over the lazy dog")
  10. (nreverse (split-by-one-space "the quick brown fox jumps over the lazy dog"))
  11. (loop for char across "the quick brown fox jumps over the lazy dog" collect char)
  12. (split-by-one-space "for (i = 0; i < 5; i = i + 1)")

Submitting your solution

Since this is a group assignment, please include the names of each member of your team along with "Exercise 12a" when submitting your solution.