Mercurial > hg > ishara
comparison general/funutils/bind.m @ 4:e44f49929e56
Adding reorganised general toolbox, now in several subdirectories.
author | samer |
---|---|
date | Sat, 12 Jan 2013 19:21:22 +0000 |
parents | |
children | fbc0540a9208 |
comparison
equal
deleted
inserted
replaced
3:3f77126f7b5f | 4:e44f49929e56 |
---|---|
1 function cfn=bind(fn,varargin) | |
2 % bind - Create a partially applied function | |
3 % | |
4 % BIND(fn,a1,a2,...) | |
5 % If fn is an ordinary function, the parameters a1, a2 etc | |
6 % are bound as the first few arguments | |
7 % | |
8 % If fn is a function object as returned by FUNC, BIND, or PERM, | |
9 % the given parameters are bound to the free slots of the function | |
10 % and a new partially applied function is returned. | |
11 % | |
12 | |
13 if ischar(fn), fn=str2func(fn); end | |
14 if ~isa(fn,'func'), fn=func(fn); end | |
15 cfn=bind(fn,varargin{:}); |