Fundamentals of CS I (CS151 2001S) : Reference

make-string - build a string by repeating one letter

Proceduremake-string
Parametersn, a non-negative integer
c, a character
PurposeGenerates a string that contains n copies of c.
Producesstr, a string.
PreconditionsOne or two parameters (verified).
n is a non-negative integer (verified).
c is a character (verified).
PostconditionsThe result is a string.
(string-ref str i) produces c for i from 0 to n-1.
Examples
> (make-string 5 #\a)
"aaaaa"
> (make-string 0 #\a)
""
> (make-string 3 "a" "b")
make-string: expects 1 to 2 arguments, given 3: 3 "a" "b"
Note
If the second parameter is not supplied, creates
  a string of the appropriate length, but filled with
  null characters (#\nul).
See Also
  string

Disclaimer: I usually create these pages on the fly. This means that they are rarely proofread and may contain bad grammar and incorrect details. It also means that I may update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This page was generated by Siteweaver on Thu Feb 22 05:48:06 2001.
This page may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2001S/make-string.html.
You may validate this page's HTML.
The source was last modified Sun Feb 4 20:56:47 2001.