'length' extension for multiple input arguments?
John W. Eaton
jwe at octave.org
Wed Feb 4 15:52:04 CST 2009
On 4-Feb-2009, Søren Hauberg wrote:
| Yeah, I guess I should mentioned this in my previous mail... My problem
| with the above solution is that I find the code hard to read. It can be
| made somewhat simpler just by doing
|
| cellfun ("length", {"hello", 7, "hello world"})
|
| as 'cellfun' has a special case for the 'length' function. But I still
| find calling 'length' directly much more intuitive.
|
| Søren
|
| P.S. I do realise that this is really a _minor_ issue, but I've been
| annoyed with it several times.
If you don't want the special case, use @length or @numel.
I think it is better to avoid adding special cases for cell arrays in
functions like length. If you add the special case to length, then
what about numel, islogical, isfoo, isbar, etc.? Oh, the madness!
Where would it all end?
BTW, most times when people use length, they should really be using
numel.
jwe
More information about the Octave-maintainers
mailing list