But it is not working. I get an error when I run the procedure, which says this: "string-append: expects type <string> as 2nd argument, given: #<void>; other arguments were: """
What am I doing wrong here?
The issue is that your char_toupper function actually returns void... In fact, the display function
(display <>) has no return value. That is,
(void? (display "a")) returns #t...
But you are using your char_toupper function as though it were returning an upper case character. If you want to use it like this, then you should modify it so that it actually returns the uppercase character to be used in string-append. Alternatively, you could modify your string_toupper function so that it does not require a result from char_toupper. That is, simply output the uppercase characters one character at a time (as your char_toupper currently does), and do not construct an entirely new string of uppercase characters... This would actually be faster since you would not require string-append, which takes O(n) time (although may not be the purpose of the assignment... it depends on whether or not your string_toupper need return a value...)
Hope that makes sense!
Last edited by n1337; Nov 12th, 2009 at 11:19 am.
Reputation Points: 55
Solved Threads: 10
Junior Poster in Training
Offline 96 posts
since May 2008