added {} and [] notations, added new function of -> operator and retired element()

This commit is contained in:
gnembon committed 2020-06-28 23:04:14 -03:00
1 parent 391c7b976e
commit b9daf50236
5 files changed
+126 -63

No files matched your search

@@ -1463,20 +1463,6 @@ public class Expression
return (cc, tt) -> ret;
});
//Deprecated, use "get" instead, or . operator
addBinaryFunction("element", (v1, v2) ->
{
if (!(v1 instanceof ListValue))
throw new InternalExpressionException("First argument of 'get' should be a list");
List<Value> items = ((ListValue)v1).getItems();
long index = NumericValue.asNumber(v2).getLong();
int numitems = items.size();
long range = abs(index)/numitems;
index += (range+2)*numitems;
index = index % numitems;
return items.get((int)index);
});
addLazyFunction("put", -1, (c, t, lv) ->
{
if(lv.size()<2)