package nxm.train.prim;

import nxm.sys.inc.*;
import nxm.sys.lib.*;

/** Deletes numeric results. */
public class primlab3 extends Primitive {

  public int open() {
    for (int i = 1; i <= MA.getNArgs(); i++) {
      String name = MA.getU(i);
      Object val  = MR.get(name);
      
      if (val == null) {
        M.warning("Can not delete result "+name+": no such result.");
        
      } else if (StringUtil.isNumber(val.toString())) {
        MR.remove(name);
        if (verbose) {
          M.info("Deleted "+name+" (old value = "+val+")");
        }
        
      } else {
        M.warning("Can not delete result "+name+": not a number.");
      }
    }
    
    return FINISH;
  }
}