// ( items n -- items[n] ) public override void Execute(Interpreter interp) { IntItem n = (IntItem)interp.StackPop(); ArrayItem items = (ArrayItem)interp.StackPop(); interp.StackPush(items.ArrayValue[n.IntValue]); }
// ( array forthic -- ? ) public override void Execute(Interpreter interp) { StringItem forthic = (StringItem)interp.StackPop(); ArrayItem indices = (ArrayItem)interp.StackPop(); if (indices.ArrayValue.Count == 2) { IntItem i_max = (IntItem)indices.ArrayValue[0]; IntItem j_max = (IntItem)indices.ArrayValue[1]; for (var i = 0; i < i_max.IntValue; i++) { for (var j = 0; j < j_max.IntValue; j++) { interp.StackPush(new IntItem(i)); interp.StackPush(new IntItem(j)); interp.Run(forthic.StringValue); } } } }
public bool IsEqual(IntItem rhs) { double delta = this.DoubleValue - rhs.DoubleValue; return Math.Abs(delta) < tolerance; }
public bool IsEqual(IntItem rhs) { return(this.IntValue == rhs.IntValue); }