Hi Lowell Kirsh,
I want to write a function to take a list of strings and a delimiter and return a string with the strings put together with the delimiter as glue.
e.g. (join '("foo" "bar" "baz")) -> "foo:bar:baz"
(defun join (list &optional (delimiter #\:))
(let ((countdown (length list)))
(with-output-to-string (stream)
(dolist (item list)
(write-string item stream)
(decf countdown)
(unless (zerop countdown)
(write-char delimiter stream))))))
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 415 |
Nodes: | 16 (2 / 14) |
Uptime: | 52:07:18 |
Calls: | 8,728 |
Calls today: | 1 |
Files: | 13,276 |
Messages: | 5,958,290 |