<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>

<STYLE>
.ExternalClass .EC_hmmessage P
{padding:0px;}
.ExternalClass body.EC_hmmessage
{font-size:10pt;font-family:Verdana;}
</STYLE>
hello, <BR>&nbsp;<BR>i just started scheming, and i still got a lot of beginner-questions. <BR>with this one, i'm blocked for a while, so is there someone who can help me out? <BR>at first, i present my basic code, at the end, you can see what it should do (and what it doesn't).<BR>my problem is the global set! of a variable (here = item-index) and correctly store this in a list.<BR>is there someone who can make me see the light? <BR>thank you in advance! <BR>&nbsp;<BR>; i'm using R5RS<BR>(define item-index 0)<BR>(define new-item (vector item-index 'new-item))<BR>(define (index item) (vector-ref item 0))<BR>(define list-of-items '())<BR>(define (add-item item-name)<BR>&nbsp;&nbsp;&nbsp; (if (empty? list-of-items)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (begin (set! item-index (+ item-index 1))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(set! list-of-items (list item-name)))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (begin (set! item-index (+ item-index 1))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vector-set! item-name 0 item-index)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (set! list-of-items (append list-of-items (list item-name))))))<BR>(add-item new-item)<BR>(add-item new-item)<BR>(add-item new-item)<BR>(add-item new-item)<BR>list-of-items<BR>item-index<BR><BR>; should be<BR>; &gt; (#(1 new-item) #(2 new-item) #(3 new-item) #(4 new-item))<BR>; &gt; 4<BR>; but results in<BR>; &gt; (#(4 new-item) #(4 new-item) #(4 new-item) #(4 new-item))<BR>; &gt; 4<br /><hr />Nagenieten met je vrienden over het laatste reisje of feestje?  <a href='http://www.microsoft.com/belux/nl/windows/windowslive/products/photos.aspx' target='_new'>Maak een groepsalbum aan.</a></body>
</html>