[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Making sort a method of Array<T>, Sparse<T> and octave_value classes
From: |
John W. Eaton |
Subject: |
Making sort a method of Array<T>, Sparse<T> and octave_value classes |
Date: |
Thu, 31 Jan 2008 03:59:32 -0500 |
On 27-Jan-2008, David Bateman wrote:
| There was some discussion before 3.0 to make functions like sort,
| spkron, min, max, etc members of the the octave_value classes so that
| the mess of if/else statements in these DEFUN functions might be
| removed. I chose to give the sort method this treatment first as it
| seemed to me to be probably the hardest to do and so is a good test of
| whether it is worth the effort, and yes its taken me a while to get it
| right.
|
| Find attached a patch that moves the sort function to be methods of
| Array<T> and Sparse<T> and then significantly simplifies the Fsort
| function. In fact it moves Fsort to data.cc and DLD-FUNCTIONS/sort.cc
| should also be removed.
Agreed.
| In any case, this patch is for discussion and to see whether its a good
| idea to do the same with other functions and if so which ones?
I'd like to make this change, and similar changes for other functions
like max and min so that we can avoid the conditionals in the DEFUN
functions, and so that other data types can be handled simply by
defining the appropriate method in the octave_value class hierarchy.
Do you see a reason to not do it?
jwe