Functions for joining strings together.
Concatenating strings in ACL2 is fundamentally slow. Why? In Common Lisp,
strings are just arrays of characters, and there is not any mechanism for
efficiently splicing together arrays. Any kind of string concatenation, then,
minimally requires creating a completely new array and copying all of the input
characters into it. This makes it especially slow to repeatedly use, e.g.,
cat to build up a string.
To build strings more efficiently, a good general strategy is to build up a
reverse-order character list, and then convert it into a string at the end.
See for instance the functions revappend-chars and rchars-to-string, which make this rather easy to do.
- Append a string's characters onto a list, in reverse order.
- Append a string's characters onto a list.
- Concatenate a list of strings with some separator between.
- Alternative to concatenate that has a shorter name and may in
some cases be more efficient.
- Possibly optimized way to reverse a character list and coerce it to a
- Concatenates a prefix onto every string in a list of strings.