|
From: | William Ramsay |
Subject: | [Chicken-users] Set! question |
Date: | Fri, 04 May 2007 08:12:30 -0400 |
User-agent: | Thunderbird 1.5.0.10 (X11/20070221) |
Hi,I'm suddenly confused on how set! works. Suppose I have two variables, A & B. If A ="Hello" and I call (set! B A), both A and B will equal "Hello". If I call (set! B "Good-bye") I would assume that B now equals "Good-bye" and that A still equals "Hello", but is this the case?
My real call was a bit more complex (i.e (set! B (vector-ref A 6))). In this case I assume the same will be true. If (vector-ref A 6) equals "Hello" as above, when I set B to "Good-bye" the vector reference also changes. It is after all, a reference - but if changing B changes A, how do I keep this from happening? I want to get the value from the vector, play with it a bit, but leave it's vector value alone.
Bill
[Prev in Thread] | Current Thread | [Next in Thread] |