Is the symbol hyperbola a string?
Is the character #\A a string?
Does the null string count as a string?
Suggest two ways of constructing the string ??? -- one using a call
to make-string, the other a call to string.
Here are two opposing views about the relationship between string-length and string-ref:
``No matter what string str is, provided that it's not the null
string, (string-ref str (string-length str)) will return the last
character in the string.''
``No matter what string str is, (string-ref str (string-length
str)) is an error.''
Which, if either, of these views is correct? Why?
Design, write, and test a Scheme procedure tally-vowels that takes
one argument, a string, and determines how many characters in that string
are vowels. (For this purpose, you should count only the ten characters
#\a, #\e, #\i, #\o, #\u, #\A,
#\E, #\I, #\O, and #\U as vowels.)
Design, write, and test a Scheme procedure consonant-part that takes
one argument, a string, and returns a string similar to its argument except
that all of the vowels have been removed. (For instance, the value of
(consonant-part "asparagus") should be "sprgs".)
Design, write, and test a Scheme procedure that constructs and returns a ``letterspaced'' version of a given string by inserting an extra space after every non-whitespace character in the string except the last.
> (letterspace "wombat") "w o m b a t" > (letterspace "Spread out the text!") "S p r e a d o u t t h e t e x t !" > (letterspace "oo") "o o" > (letterspace "I") "I" > (letterspace "") ""
Standard Scheme does not provide procedures for converting all the letters
in a string to upper case or to lower case. Remedy this defect by writing
your own string-upcase and string-downcase procedures.
The principal author of this lab is Professor Henry Walker. I am also indebted to Professor Ben Gum for his contributions to its development.