.. efun:: mixed apply(closure cl, ...) Evaluates the closure :arg:`cl` with the following arguments. If the last argument is an array or struct, it will be flattened: ie. the array/struct itself will be removed and its contents added to the argument list of :arg:`cl`. If :arg:`cl` is not a closure, it will simply be returned (and all other arguments are ignored). .. usage:: The flattening of the last argument is the important difference between :efun:`apply` and :efun:`funcall`. For example:: mixed eval(object ob, string func, mixed *args) { return apply(#'call_other, ob, func, args); } This will result in calling:: ob->func(args[0],args[1],...,args[sizeof(args)-1]). Using :efun:`funcall` instead of :efun:`apply` would have given us:: ob->func(args). Of course, with the '...' operator we could also write:: mixed eval(object ob, string func, mixed *args) { return funcall(#'call_other, ob, func, args...); } and achieve the same result. :history 3.2@70 introduced: :history 3.2.8 changed: adds the returning of a non-closure as first argument. :history 3.3 changed: added the '...' operator and thus made :efun:`apply` in fact redundant. :history 3.3.266 changed: added support for structs. .. seealso:: :efun:`funcall`, :type:`closure`, :keyword:`varargs`