Open kilianmh opened 9 months ago
Some functions have been worked out to also accept characters:
(str:join #\Newline '( "hello" "test"))
so I think we should allow characters for all, including concat
.
we should allow characters for all, including
concat
good idea. Could concat
also accept numbers?
2.
The only annoying thing with characters is the special syntax #\
. So what you think if we define e.g. whitespace-characters as variable / constant to make it more "lispy" working with characters. For example:
(defvar new-line #\Newline)
(defconstant tab #\Tab)
3.
Also one idea was introducing functions such as new-lines
(or new-line
?), that contain multiple times the same characters:
(defun new-lines (lines)
(let ((result ""))
(dotimes (var lines)
(setf result (str:concat result "
")))
result))
CL-USER> (new-lines 2)
"
"
Since some functions (such as concat) only accept strings. Therefore sometimes it is convenient to have characters as strings. E.g.
The we could use it in concat like this:
It could be useful, especially for the whitespace characters (e.g. for space) but maybe also others. What do you think?