more stupid errors



On 5/24/07, Thomas Widlar <twidlar at yahoo.com> wrote:

>        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
>      },

Well, there are various instances of { and } in the place of ( and ) here.
Those also need to be replaced.

Maxima recognizes { ... } as a literal set e.g. {a, b, c}.
A compound expression, comprising multiple expressions and
evaluated one by one, is (a, b, c) or block(a, b, c).
The body of a for-loop is an expression (be it simple or compound)
and although a literal set { ... } is an expression and therefore
acceptable as a loop body, writing for <whatever> { ... } is probably
not going to have the effect you intended.

Aside from all that, my guess is that you could substantially
simplify your program by first constructing a list of tuples from
the input, then filtering the list to omit the (0, 0, 0) ones.

HTH
Robert