<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16809" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face="Courier New" size=2>Consider:</FONT></DIV>
<DIV><FONT face="Courier New" size=2>(define a (list 1 2))</FONT></DIV>
<DIV><FONT face="Courier New" size=2>(define b (list a a))</FONT></DIV>
<DIV><FONT face="Courier New" size=2>Now the two elements of list b are shared.
No set! required to do that. You may or you may not want to show the sharing in
the output. Because lists are immutable, the fact that two elements are shared
makes no difference as long as the elements are immutable too. Compare this
to:</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>(define a (list (box 1) (box 2))) ;
mutable elements!</FONT></DIV>
<DIV><FONT face="Courier New" size=2>(define b (list a a))</FONT></DIV>
<DIV><FONT face="Courier New" size=2>(set-box! (car a) 3)</FONT></DIV>
<DIV><FONT face="Courier New" size=2>b --> (list (list (box 3) (box 2)) (list
(box 3) (box 2))) or</FONT></DIV>
<DIV><FONT face="Courier New" size=2>b --> (shared ((-1- (list (box 3) (box
2)))) (list -1- -1-))</FONT></DIV>
<DIV><FONT face="Courier New" size=2>depending on the output mode.</FONT></DIV>
<DIV><FONT face="Courier New" size=2></FONT> </DIV>
<DIV><FONT face="Courier New" size=2>Jos</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=chadestioco@gmail.com href="mailto:chadestioco@gmail.com">Andrei
Estioco</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=plt-scheme@list.cs.brown.edu
href="mailto:plt-scheme@list.cs.brown.edu">plt-scheme@list.cs.brown.edu</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, February 17, 2009 11:53
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [plt-scheme] Re: It gets
shared!</DIV>
<DIV><BR></DIV><BR>Oh...well yes that solved my problem for Advanced Student.
Thanks. But my question remains. What part of my code made it shared? I
mean...I didn't even use set! . Well, as far as I know, set! is the only way
in Scheme to have values shared.<BR clear=all><BR>-- <BR>Chad Estioco<BR>BS
Computer Science<BR>University of the
Philippines-Diliman<BR>==============================<BR><A
href="http://www.geocities.com/lokisky_walker">http://www.geocities.com/lokisky_walker</A><BR>
<P>
<HR>
<P></P>_________________________________________________<BR> For
list-related administrative tasks:<BR>
http://list.cs.brown.edu/mailman/listinfo/plt-scheme<BR></BLOCKQUOTE></BODY></HTML>