samer@4: function varargout=apply(fn,args) samer@4: % apply - Apply function to list (cell array) of arguments samer@4: % samer@12: % apply :: samer@12: % (A:typelist(N)->B:typelist(M)) ~'function with N inputs and M outputs', samer@12: % cell { A:typelist(N) } ~'cell array with N elements of types AX' samer@12: % -> B{1}, ..., B{M} ~'M return values of types B{1} to B{M}'. samer@4: samer@12: [varargout{1:max(1,nargout)}] = fn(args{:});