[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Collecting data into a string.



Title: RE: Collecting data into a string.

Hi Jordan,

> ;;
> ;; This is my version of a string concatenation function.
> ;; I was *extremely* surprised to find that the MzScheme manual had
> ;; no function to concatenate strings.  If I overlooked it or if you
> ;; can think of a better way to write this one, let me know.
> ;;
> (define (string-concat str1 str2)
>   (let ((s-list1 (string->list str1))
>         (s-list2 (string->list str2)))
>     (list->string (append s-list1 s-list2))))
>

Doesn't string-append do what you want?:
> (string-append "dog" " " "food.")
"dog food."

Were you seeking to create a list or something?

-Brent