chickadee » srfi-13 » string-concatenate-reverse

(string-concatenate-reverse string-list [final-string end]) -> stringprocedure
(string-concatenate-reverse/shared string-list [final-string end]) -> stringprocedure

With no optional arguments, these functions are equivalent to

(string-concatenate (reverse STRING-LIST))


(string-concatenate/shared (reverse STRING-LIST))


If the optional argument FINAL-STRING is specified, it is consed onto the beginning of STRING-LIST before performing the list-reverse and string-concatenate operations.

If the optional argument END is given, only the first END characters of FINAL-STRING are added to the string list, thus producing

  (reverse (cons (substring/shared FINAL-STRING 0 END)


(string-concatenate-reverse '(" must be" "Hello, I") " going.XXXX" 7)
  => "Hello, I must be going."

This procedure is useful in the construction of procedures that accumulate character data into lists of string buffers, and wish to convert the accumulated data into a single string when done.

Unicode note: Reversing a string simply reverses the sequence of code-points it contains. So a zero-width accent character AC coming after a base character BC in string S would come out before BC in the reversed result.