public Value Insert(List Arguments) { Value first = Arguments.GetValue(0); int index; if (first is Number) { index = (int)((first as Number).Val); } else { throw new Exception("First parameter must be a number"); } var second = Arguments.GetValue(1); if (index >= 0 && index < Arr.Count) { Arr.Insert(index, new Reference(second)); } else { throw new Exception("Index is out of bounds"); } return(this); }
public Value Ceiling(List Arguments) { if (Arguments.GetValue(0) is Number) { return(new Number(Math.Ceiling(((Number)Arguments.GetValue(0)).Val))); } throw new Exception("Ceiling function takes only a number"); }
public Value Floor(List Arguments) { if (Arguments.GetValue(0) is Number) { return(new Number(Math.Floor(((Number)Arguments.GetValue(0)).Val))); } throw new Exception("Floor function takes only a number"); }
public Value RemoveAt(List Arguments) { for (int i = 0; i < Arguments.Arr.Count; i++) { Value value = Arguments.GetValue(i); if (value is Number) { var index = (int)(value as Number).Val; Arr.RemoveAt(index); } } return(this); }
public Value Tan( List Arguments ) { if ( Arguments.GetValue( 0 ) is Number ) return new Number( Math.Tan( ( (Number)Arguments.GetValue( 0 ) ).Val ) ); throw new Exception( "Tan function takes only a number" ); }