view 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
line wrap: on
line source
function cfn=bind(fn,varargin)
% bind - Create a partially applied function
% 
% BIND(fn,a1,a2,...)
%    If fn is an ordinary function, the parameters a1, a2 etc
%    are bound as the first few arguments
%
%    If fn is a function object as returned by FUNC, BIND, or PERM,
%    the given parameters are bound to the free slots of the function
%    and a new partially applied function is returned.
%

if ischar(fn), fn=str2func(fn); end
if ~isa(fn,'func'), fn=func(fn); end
cfn=bind(fn,varargin{:});