annotate general/funutils/bind.m @ 8:f0a3d7d7a0e3

Renamed cat_sep function to catsep
author samer
date Mon, 14 Jan 2013 14:54:10 +0000
parents e44f49929e56
children fbc0540a9208
rev   line source
samer@4 1 function cfn=bind(fn,varargin)
samer@4 2 % bind - Create a partially applied function
samer@4 3 %
samer@4 4 % BIND(fn,a1,a2,...)
samer@4 5 % If fn is an ordinary function, the parameters a1, a2 etc
samer@4 6 % are bound as the first few arguments
samer@4 7 %
samer@4 8 % If fn is a function object as returned by FUNC, BIND, or PERM,
samer@4 9 % the given parameters are bound to the free slots of the function
samer@4 10 % and a new partially applied function is returned.
samer@4 11 %
samer@4 12
samer@4 13 if ischar(fn), fn=str2func(fn); end
samer@4 14 if ~isa(fn,'func'), fn=func(fn); end
samer@4 15 cfn=bind(fn,varargin{:});