Re: Scheme Review bootstrapped
Marc Nieper-Wißkirchen 02 Dec 2022 16:23 UTC
Am Fr., 2. Dez. 2022 um 16:10 Uhr schrieb Lassi Kortela <xxxxxx@lassi.io>:
>
> > The name is then a bit misleading. The established symbol-xxx
> > procedures work on symbols.
> >
> > Consider changing its name to something like append-to-symbol. Or
> > generic-append/symbol. Analogous would be append-to-vector,
> > append-to-string, ...
>
> Common Lisp has:
>
> > (concatenate 'string "fo" '(#\o #\b) #(#\a #\r))
> "foobar"
>
> > (concatenate 'vector "fo" '(#\o #\b) #(#\a #\r))
> #(#\f #\o #\o #\b #\a #\r)
>
> > (concatenate 'list "fo" '(#\o #\b) #(#\a #\r))
> (#\f #\o #\o #\b #\a #\r)
>
> We could imagine:
>
> > (concatenate 'symbol "fo" '(#\o #\b) #(#\a #\r))
> |foobar|
Concatenate is already taken by SRFI 1. Would probably be confusing
to attach a different meaning to it.
(concatenate 'symbol ...)
doesn't look like modern Scheme to me. If concatenate-symbol,
concatenate-string, ... is no option (ignoring the SRFI 1-issue here),
I would at least propose
(concatenate (result-type symbol) "fo" '(#\o #\b) #(#\a #\r))
with
(define-enumerate result-type
(string vector list symbol bytevector)
result-types)
(In effect, (result-type symbol) expands into 'symbol but with
compile-time checking (so that (result-type zymbol) results in an
early error).)