comparison src/ov-fcn-handle.cc @ 14175:3972c4caa60a stable

Add new function is_function_handle (patch #7695) * contributors.in: Add Juan Pablo Carbajal to list of contributors. * func.txi: Add docstring to function handle chapter. * ov-fcn-handle.cc: Add new function is_function_handle ().
author Juan Pablo Carbajal <carbajal@ifi.uzh.ch>
date Sun, 08 Jan 2012 20:26:35 -0800
parents 72c96de7a403
children eff4a5933e28
comparison
equal deleted inserted replaced
14174:447b57ebc27b 14175:3972c4caa60a
1773 %!endfunction 1773 %!endfunction
1774 %! 1774 %!
1775 %!assert (__testrecursionfunc (@(x) x, 1), 8) 1775 %!assert (__testrecursionfunc (@(x) x, 1), 8)
1776 1776
1777 */ 1777 */
1778
1779 DEFUN (is_function_handle, args, ,
1780 "-*- texinfo -*-\n\
1781 @deftypefn {Built-in Function} {} is_function_handle (@var{x})\n\
1782 Return true if @var{x} is a function handle.\n\
1783 @seealso{isa, typeinfo, class}\n\
1784 @end deftypefn")
1785 {
1786 octave_value retval;
1787
1788 int nargin = args.length ();
1789
1790 if (nargin == 1)
1791 retval = args(0).is_function_handle ();
1792 else
1793 print_usage ();
1794
1795 return retval;
1796 }
1797
1798 /*
1799 %!shared fh
1800 %! fh = @(x) x;
1801
1802 %!assert (is_function_handle (fh))
1803 %!assert (! is_function_handle ({fh}))
1804 %!assert (! is_function_handle (1))
1805 %!error is_function_handle ();
1806 %!error is_function_handle (1, 2);
1807
1808 */
1809
1778 1810
1779 octave_fcn_binder::octave_fcn_binder (const octave_value& f, 1811 octave_fcn_binder::octave_fcn_binder (const octave_value& f,
1780 const octave_value& root, 1812 const octave_value& root,
1781 const octave_value_list& templ, 1813 const octave_value_list& templ,
1782 const std::vector<int>& mask, 1814 const std::vector<int>& mask,