apply

./efun/apply · 705 B

From the archive driver-docs-3.2@238-07-dec-93.tar.gz

Download the archive   « Back to the archive contents

SYNOPSIS
	mixed apply(closure cl, ...)

DESCRIPTION
	Evaluates the closure.

	One might wonder why there are two functions, funcall() and
	apply(), to perform the seemingly same job, namely evaluating
	a closure. Of course there is a subtle difference. If the last
	argument to apply() is an array, then each of its elements
	gets expanded to an additional paramater. The obvious use
	would be #'call_other as in:

	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 funcall() instead of apply() would have given us
	ob->func(args).

SEE ALSO
	funcall(E), closures(LPC)

Site Stats

Snippets: 1791
Codebases: 571