This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
PATCH: Handle symbols in messages
- From: Doug Evans <dje at transmeta dot com>
- To: Jim Blandy <jimb at redhat dot com>
- Cc: cgen at sources dot redhat dot com
- Date: Thu, 20 Jan 2005 16:26:08 -0800 (PST)
- Subject: PATCH: Handle symbols in messages
- References: <vt2fz0vvhjm.fsf@zenia.home>
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))))