itermax: 100;

mandel(c) := block([z: 0, iter: 0],
    while iter < itermax and abs(z) <= 2 do (
      z: rectform(z^2 + c),
      iter: iter + 1
    ),
    if iter=itermax then toc: append(toc,[[realpart(c),imagpart(c)]])
  );

toc: []$
for x: -2 thru 0.5 step 0.01 do 
  for y: -1 thru 1 step 0.01 do mandel(x+y*%i)$
wxplot2d([discrete,toc],[style,[points,0.5]], [color,black],[x,-2,0.5],[y,-1,1]);