Cody

# Problem 582. Function composition - harder

Solution 76384

Submitted on 13 Apr 2012 by Freddy
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% f1 = @(x)x+1; f2 = @(x)3*x; f3 = @sqrt; h = compose(f1,f2,f3); assert(isequal(h(9),10));

h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x))

2   Pass
%% f = repmat({@(x)x+1},1,100); h = compose(f{:}); assert(isequal(h(0),100));

h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x)) h = @(x)h(varargin{i}(x))

3   Pass
%% f = @(x)x; h = compose(f); assert(isequal(h(1234),1234));

h = @(x)h(varargin{i}(x))