private IValue Extract(IArray set, IArray selection) { var res = new ListArray(); foreach (var item in selection) { if (item.Type != ValueType.Number) { throw new WrongOperandTypeException(); } res.Add(set.At((int)item.AsDouble)); } return(new ArrayValue(res)); }