block, for and variable scope



I don't know what "move" does, but

(curpos:[0,0],
curpos: block(
   [curpos:curpos],
   for i:0 thru 2 do curpos:qq(i),
   curpos
));

Leaves qq(2)  as the value of curpos. So my guess is that "move" returns
either false or done.
It would not hurt to use a different name for the local variable, would it?

RJF

 

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu 
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Robert 
> Willam Grieve
> Sent: Saturday, May 12, 2007 5:57 AM
> To: maxima at math.utexas.edu
> Subject: block, for and variable scope
> 
> Hello list,
> I have been lurking on this for some time and went on  sabatical 
> last year, but I recently began using Maxima again. I am now
> using wxMaxima  as in
> 
> wxMaxima 0.7.2 http://wxmaxima.sourceforge.netMaxima 5.11.0 
> http://maxima.sourceforge.net
> Using Lisp CMU Common Lisp CVS Head 2007-05-11 17:18:25 (19D)
> 
> which is what I get when I start up.
> The new wxMaxima is much more useful and it really is letting me 
> work faster. The ability to save the in/output etc and batch it 
> in is superb, just what I was hoping. Unfortunetely, I have 
> attempted a program, and now the real fun begins to happen.
> 
> Assuming I have:
> 
> curpos:[0,0]
> 
> I have written a function move(curpos, dir) where dir is in 0 to 
> 3 and t returns a list as [x,y];
> 
> So what this is supposed to do is move you around a matrix ie 
> curpos:[0,0]$
> curpos:move(curpos, 0);
> [1,0]  /Move right 
> 
> but I want to move right then down, then left which are dirs 
> 0,1,2 so I tried various code that was variations of 
> 
> curpos:[0,0]
> curpos: block(
>    [curpos:curpos],
>    for i:0 thru 2 do curpos:move(curpos, i),
>    curpos
> );
> 
> which should give [0,1], but all I got was either done or false, 
> depending on I have no idea what, even though I swear, I have 
> rtFm. (By the way, the manual excels, I don't not vice versa)
> 
> If anyone can help, thanks.
> If not... feel free to ignore or mock this message as it 
> deserves.
> 
> All the best on the new release.
> 
> sonofthejedi
> -- 
> Robert W. Grieve <sonofthejedi at xtra.co.nz>
> 3rd Year, Bachelor of Information Technology
> Southern Institute of Technology, Invercargill, New Zealand
> "Gold is not all that glitters, not all who wander are lost."
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>