octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'length' extension for multiple input arguments?


From: John W. Eaton
Subject: Re: 'length' extension for multiple input arguments?
Date: Wed, 4 Feb 2009 16:52:04 -0500

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]