Beispiel #1
0
  public final Func bind(List args) {
    if (args.sz() == 0) return this;
    if (args.sz() > params().sz()) throw ArgErr.make("args.size > params.size");

    Type[] newParams = new Type[params().sz() - args.sz()];
    for (int i = 0; i < newParams.length; ++i)
      newParams[i] = ((Param) params().get(args.sz() + i)).type;

    FuncType newType = new FuncType(newParams, this.returns());
    return new BindFunc(newType, this, args);
  }
Beispiel #2
0
    public Object callList(List args) {
      int origReq = (int) orig.arity();
      int haveSize = bound.sz() + args.sz();
      Method m = orig.method();
      if (m != null) {
        origReq = m.minParams();
        if (haveSize > origReq) origReq = haveSize;
      }
      if (origReq <= bound.sz()) return orig.callList(bound);

      Object[] temp = new Object[haveSize];
      bound.copyInto(temp, 0, bound.sz());
      args.copyInto(temp, bound.sz(), temp.length - bound.sz());
      return orig.callList(new List(Sys.ObjType, temp));
    }
Beispiel #3
0
 public Object callOn(Object obj, List args) {
   Object[] array = new Object[args.sz() + 1];
   array[0] = obj;
   args.copyInto(array, 1, args.sz());
   return callList(new List(Sys.ObjType, array));
 }