On Thu, 17 Mar 2016 13:08:44 -0500,
Arnel wrote:
>
> Hi,
>
> How does 'string-join' differ from 'string-append'? More specifically, why
> does
> the following code:
>
> (let ([z ""]
> [y "b"])
> (string-join '(z y) "\n"))
>
> result in a contract violation, yet the following:
>
> (let ([z ""]
> [y "b"])
> (string-append z y))
>
> works without any issues. (It's not necessarily the result I wanted, but I can
> work around it.) Isn't '(z y) essentially a list of strings?
'(z y) is not a list of strings. It's a list with two symbols, 'z and 'y.
(list z y) will be a list with the two strings you want.
The quote form does create a list in this case, but it does not evaluate
any of its subforms. Hence why you get symbols, as opposed to the values
of your variables.
Vincent
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.