On Thu, 17 Mar 2016 13:20:34 -0500, Vincent St-Amour
<stamo...@eecs.northwestern.edu> wrote:
> 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 "aaaa"]
> >       [y "bbbbb"])
> >   (string-join '(z y) "\n"))
> > 
> > result in a contract violation, yet the following:
> > 
> > (let ([z "aaaa"]
> >       [y "bbbbb"])
> >   (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

"In that moment, the monk was enlightened."

Thanks, Vincent.

----
Thank you,
Arnel

-- 
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.

Reply via email to