<br><br><div class="gmail_quote">On Thu, Nov 26, 2009 at 18:23, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
(define str "sdfdsf")<br>
(display (string-append "something" str))<br>
<br>
;; if you really like the + symbol, define + to do some more locally<br>
<br>
#lang scheme<br>
<br>
(local ((define + (let ((+ +)) (lambda x<br>
(cond<br>
[(null? x) 0]<br>
[(string? (car x)) (apply string-append x)]<br>
[else (apply + x)])))))<br>
<br>
(define str "sdfdsf")<br>
(display (string-append "something" str)))<br></blockquote><div><br><br>On the last line, Matthias probably meant:<br> (display (+ "something" str)))<br><br>which shows that + ca be redefined locally to act like string-append (and still keep its usual meaning on numbers).<br>
<br>Laurent<br><br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5"><br>
<br>
On Nov 26, 2009, at 7:43 AM, Charlie Smith wrote:<br>
<br>
> hi<br>
><br>
> i'd like to know if there is some way of adding strings (sorry, i don't what the correct term for this is, maybe variable interpolation?) like for example in ruby it would be like<br>
><br>
> str = "sdfdsf"<br>
> puts "something" + str<br>
> output: "somethingsdsdf"<br>
><br>
> the function string-append isn't what I want, because i would be adding strings somewhat arbitarily in between other strings<br>
><br>
><br>
><br>
><br>
</div></div><div><div></div><div class="h5">> _________________________________________________<br>
> For list-related administrative tasks:<br>
> <a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>
<br>
_________________________________________________<br>
For list-related administrative tasks:<br>
<a href="http://list.cs.brown.edu/mailman/listinfo/plt-scheme" target="_blank">http://list.cs.brown.edu/mailman/listinfo/plt-scheme</a><br>
</div></div></blockquote></div><br>