@Override
    public TensorFunction<NAMETYPE> withArguments(List<TensorFunction<NAMETYPE>> arguments) {
        if ( arguments.size() > 1)
            throw new IllegalArgumentException("Generate must have 0 or 1 arguments, got " + arguments.size());
        if (arguments.isEmpty()) return this;

        if (arguments.get(0).asScalarFunction().isEmpty())
            throw new IllegalArgumentException("The argument to generate must be convertible to a tensor function, " +
                                               "but got " + arguments.get(0));

        return new Generate<>(type, null, arguments.get(0).asScalarFunction().get());
    }
Creates a generated tensor from a bound function

@param type the type of the tensor
@param generator the function generating values from a list of numbers specifying the indexes of the
                 tensor cell which will receive the value
@throws IllegalArgumentException if any of the tensor dimensions are not indexed bound
vespajlib/src/main/java/com/yahoo/tensor/functions/Generate.java