more stupid errors



Thanks, Robert, for catching the bad { instead of (. Mario had mentioned
curly brackets but I did see it. D'oh.

I've caught a lot more of my errors and misunderstanding. I've got one
at the end I can't figure out. (File is also attached). What did I do wrong?

load("stringproc")$
load("draw")$
mwords : 0$        /* TOTAL WORDS */
nwords : 0$
words : []$
line : ""$
nlines : 0$
vv : []$        /* CURRENT VECTOR OBJECT */
nvr : 0$        /* # VECT READ */
nv : 0$        /* # ACTUAL VECT */
vect : []$        /* ALL VECTOR OBJECTS */

/* OPEN FILE */
openread(fn) := block(line:"",nwords:0,words:[],openr(fn))$

/* READ TOKEN */
readword(f) := block(
[w],
for w:"" while nwords = 0 do
  (
  nwords : -1,
  line: readline(f),
  if line then
      (words:split(line), nwords:length(words), nlines:nlines+1)
  ),
if (nwords > 1) then
  (
  w : first(words),
  words : rest(words,1),
  nwords : nwords - 1,
  mwords : mwords + 1,
  w
  )
else
  false
)$


f : openread("d:/tjw/max/tstdata0.txt");
ii : readword(f);
jj : readword(f);
kk : readword(f);
nn : readword(f);

for n:1 thru nn do
  {
  vv : [],    /* INITIALIZE VECTOR OBJECT */
  nvr : 0,    /* NO. VECT READ */
  nv : 0,    /* NO. ACTUAL VECT */
  x : 0,
  for i:1 thru ii do
    (
    y : 0,
    for j:1 thru jj do
      (
      z : 0,
      for k:1 thru kk do
         {
         vx : readword(f), 
         vy : readword(f),
         vz : readword(f),
         nvr : nvr + 1,
         if (nwords < 0) then go(xeof), /* EOF */
         if vx # 0 or vy # 0 or vz # 0 then
            (
            vv : cons(vector([x,y,z],[vx,vy,vz]),vv),
            nv : nv + 1
            ),          /* MAKE VECTOR OBJECT */
         z : z + dz
         },
       y : y + dy
                ^
Incorrect syntax: Missing )
       },
    x : x + dx
    },
xeof,
  vect[n] : vv,
  apply(draw3d,vv)
  }
closer(f);


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: drawtest.mac
Url: http://www.math.utexas.edu/pipermail/maxima/attachments/20070524/e4472de3/attachment-0001.diff