On Sun, 13 May 2007, Robert Dodier wrote:
> About the curpos problem, I suspect the answer depends on the
> definition of move. Maybe you can post move to the mailing
> list.
Ok, umm, I got it to work, but I have no idea why, as I didn't
change move. Can someone please explain why this now produces
the expected result.
[I've realigned the function defs so they can be read]
(%i6) dispfun(move);
(%t6) move(curpos,dir) := block
(
[curpos:curpos,dir:dir],
if equal(dir,0) then
return(curpos[first(curpos)+1,second(curpos)]) ,
if equal(dir,1) then
return(curpos:[first(curpos),second(curpos)+1]) ,
if equal(dir,2) then
return(curpos:[first(curpos)-1,second(curpos)]) ,
if equal(dir,3) then
return(curpos:[first(curpos),second(curpos)-1])
)
(%o6) [%t6]
(%i7) dotrans(curpos) := block
(
[curpos:curpos],
for i:0 thru 2 do
curpos:move(curpos, i),
return(curpos)
)$
(%i8) dotrans([0,0]);
(%o8) [0,1]
Which incidentally is what I expected in the first place but
what's the difference, I never changed move. Still, this is
a decent place to begin.
Thanks again
--
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."