PATCH: Handle symbols in messages
Doug Evans
dje@transmeta.com
Fri Jan 21 00:26:00 GMT 2005
fwiw, while string-concat might not clearly specify the operation
(though I don't have a problem with it), `concat' seems too generic
(or at least not string-specific enough in the way that the rest of
the string functions are so named).
string-map is to map,
as string-list is to list,
as string-<mumble> is to concat.
concat mightn't make sense outside of strings (and thus why have the
string- prefix ...), but why preclude symbol-concat? (etc.)
How about string-concat?
> diff -c -p -r1.82 utils.scm
> *** cgen/utils.scm 16 Dec 2004 21:52:37 -0000 1.82
> --- cgen/utils.scm 20 Jan 2005 22:52:04 -0000
> ***************
> *** 85,90 ****
> --- 85,96 ----
> (write (spaces n) port))
> )
>
> + ; Concatenate all the arguments and make a string. Symbols are
> + ; converted to strings.
> + (define (concat . sequences)
> + (define (sequence->string o) (if (symbol? o) (symbol->string o) o))
> + (apply string-append (map sequence->string sequences)))
> +
> ; Often used idiom.
>
> (define (string-map fn . args) (apply string-append (apply map (cons fn args))))
More information about the Cgen
mailing list