function result = doesXAppearInV(x,v)
% doesXAppearInV   return true if x appears in vector v
%
% consumes: x, a scalar value 
%           v, a vector
% produces: result, a boolean (logical) value
%
% Examples:
%   >> doesXAppearInV(5,[3 5 6 2])
%   ans =
%       1
%   >> doesXAppearInV(7,[])
%   ans = 
%       0
%   >> doesXAppearInV(7,[9 -2 1)
%   ans = 
%       0
% P. Conrad for CISC106, sect 99, 10/22/2007
  

  % //** (5 pts) Add code to check for an empty matrix
  % //**         and return the correct value in that case

  if (isempty(v) ) % //* first base case: empty matrix
    result = false;
    

  elseif ( x  == v(1) ) % second base case: x is first element

    if ( x == v(1) )
       result = true;
    end;

  else % recursive case 

    % //** (5 pts) Add code for the recursive call
    result = doesXAppearInV(x, v(2:end) ); % //* recursive call
    
  end
    
  return;
end % function
