function h = head(A, varargin)
%HEAD Get first rows of distributed array.
%   
%   HEAD(X) displays the first eight rows of the distributed array X in
%   the command window without storing a value.
%   
%   HEAD(X,K) displays up to K rows from the beginning of the distributed array
%   X. If X contains fewer than K rows, then the entire array is
%   displayed.
%   
%   Y = HEAD(X) or Y = HEAD(X,K) returns the first eight rows, or up to K
%   rows, of the distributed array X.
%    
%   See also: HEAD, DISTRIBUTED/TAIL, DISTRIBUTED.
%   
%   


%   Copyright 2016-2022 The MathWorks, Inc.

tmp = distributedutil.distributedSpmdWrapper( @head, A, varargin{:} );

% As of R2023a, head is also available for numeric arrays. It follows the
% same startegy to display and not set ANS when no output is requested.
if nargout==0
    disp(tmp);
else
    h = tmp;
end

end
