docs: function apply() {
    var args = mlutil.asArray.apply(null, arguments);
  
    var argLen = args.length;
    switch(argLen) {
    case 0:
      throw new Error('no name for function to apply');
    case 1:
      return {apply: args[0]};
    default:
      var DatatypeDef = qb.lib.DatatypeDef;
  
      var functionName = args[0];
      var content      = [];
  
      var datatype = null;
  
      var arg = null;
      var i=1;
      for (; i < argLen; i++) {
        arg = args[i];
        if (arg instanceof DatatypeDef) {
          if (datatype !== null) {
            throw new Error(datatype+' datatype without following value for '+functionName);
          }
          datatype = arg.datatype;
          continue;
        }
  
        if (datatype !== null) {
          content.push({$value: arg, $datatype: datatype});
          datatype = null;
        } else if (Object.prototype.toString.call(arg) === '[object Date]') {
          content.push({$value: arg.toISOString(), $datatype: 'xs:datetime'});
        } else {
          content.push({$value: arg});
        }
      }
  
      if (datatype !== null) {
        throw new Error(datatype+' datatype without last value for '+functionName);
      }
  
      return {apply: functionName, content: content};
    }
  }