Mercurial > hg > ishara
view arrows/perm.m @ 6:0ce3c2070089
Removed duplicate code and fixed doc in timed_action.
author | samer |
---|---|
date | Mon, 14 Jan 2013 14:33:37 +0000 |
parents | 672052bd81f8 |
children | 5de03f77dae1 |
line wrap: on
line source
% perm - arrow to permute inputs % % perm :: % N:natural ~'number of inputs', % P:[[M]->[N]] ~'permutation of inputs' % -> arrow(_:arglist(N), _:arglist(M), empty). % % This function creates an arrow whos outputs can % be copies of any of the inputs in any order. % For example, % perm(5,[3,2,5]) % is an arrow with 5 inputs and 3 outputs. Output % 1 is input 3, output 2 is input 2, and output 3 is % input 5. function a=perm(nin,p) nout=length(p); a=arr(@permfn,'nargin',nin,'nargout',length(p)); function varargout=permfn(varargin) [varargout{1:nout}]=varargin{p}; end end