11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

2.3 Local Variables and Invoking Procedures • 23f := proc() element(s, c) end proc> to 7 do f() end do;[α, x][β, x][γ, x][α, y][β, y][γ, y]FAILYou can use CartesianProduct to study several products simultaneously.> g := CartesianProduct( {x, y}, {N, Z, R},> {56, 23, 68, 92} );g := proc() element(s, c) end procThe following are the first few elements of {x, y} × {N, Z, R} ×{56, 23, 68, 92}.> to 5 do g() end do;[x, N, 23][y, N, 23][x, Z, 23][y, Z, 23][x, R, 23]The variables s in f and g are local variables to CartesianProduct,so they are not shared by different invocations of CartesianProduct.Similarly, the variable c in f and g is not shared. You can see that thetwo arrays of counters are different by invoking f and g a few more times.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!