From sources-request at octave dot org Fri Apr 14 00:38:41 2006 Subject: Re: OVER / over(arrayX,arrayY, at func) / : function implemented. From: Paul Kienzle To: Muthiah Annamalai Cc: octave src Date: Thu, 13 Apr 2006 22:47:56 -0400 On Apr 13, 2006, at 2:40 PM, Muthiah Annamalai wrote: > Hello there, > I have a implementation of OVER function > [over(arrayX,arrayY, at func)] with some test > cases. Please have a look, and see if its good enough > to > make the Octave source tree. > > I hope Im not reinventing the wheel. I'm not sure that this is a desirable function to have in octave, but I will comment on the style anyway. 1) errors should be returned to the caller, not printed in the function. The value returned in the case of an error should be an empty list. E.g., retval = octave_value_list(); error("fn: his is an error with value %d", value); return retval; 2) Generally we are not "using namespace std" but instead decorating each function with its namespace. 3) You can get vectors directly using, e.g., ColumnVector vec(args(2).vector_value()); if (error_state) return retval; Similarly: octave_function fn(args(3).function_value()); if (error_state) return retval; 4) You need the following statement in your loop: OCTAVE_QUIT; This catches Ctrl-C at the keyboard. 5) Use the following after feval: if (errorstate) return retval; - Paul