Question: When we use Maple input to define a procedure in a worksheet in Document mode, how do we evaluate/execute the command?

When we use Maple input to define a procedure in a worksheet in Document mode, how do we evaluate/execute the command. I am used to just hitting <Enter> when using 2d Math. Today, I've been trying to use Maple input, but when I hit <Enter> nothing happens, or something does happen that messes up the definition such that I get a 

Warning, premature end of input, use <Shift> + <Enter> to avoid this message.

right in the middle of the procedure which then generates a 

Error, global declaration unexpected outside procedure or module
Error, missing operator or `;`

and the only way to even execute and see these errors is by executing the whole worksheet. 

 

Attached is an example: 
 

f := proc(ix,iy)          global T:
        local x := trunc(ix), y := trunc(iy):
        print(x,y," Returning ",T[x][y]):
        return T[x][y]:
end:

g := proc (ix, iy) local x, y; global T; x := trunc(ix); y := trunc(iy); print(x, y, " Returning ", T[x][y]); return T[x][y] end proc

NULL


I can hit enter on the 2d math version, but not on the first 1d math version. On the 1d version, if I go to right after "end:" and hit <Enter> I get an error: Error, reserved word `end` unexpected.

Download 1dmathproc.mw

 

Please Wait...