[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: empty arrays of objects
From: |
ernst |
Subject: |
Re: empty arrays of objects |
Date: |
Tue, 21 May 2013 02:04:55 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120825 Thunderbird/15.0 |
HI Jordi,
ah, i understood now the concept of array language...
Well, i dont know whether this is really a bug, because i overwrote
arrayfun and maybe I did something wrong.
Tell me, why does class([]) yield double?
And why does seemingly buitlin-arrayfun not work on objects?
And, above all, why does
octave:28> a=arrayfun(@pn, [])
a = [](0x0)
octave:29> class(a)
ans = double
not lead to some pn-object as
arrayfun(@pn, [1 2 3]) does?
Greetings,
Ernst
> On 20 May 2013 17:57, ernst <address@hidden> wrote:
>> i found, that arrays have the same class as their members (which I think
>> is very strange):
> Matrices are all of uniform type. The members of arrays are themselves
> arrays. There are no true scalars or members in Octave, instead,
> anything that looks like a scalar is a 1x1 array, and ordinary arrays
> don't nest; [1,[2,3]] is the same as [1,2,3]. Cell arrays do nest and
> can be of heterogenous type.
>
>> This applies also to classes, which are not builtin:
> Because this is an array language. Everything is an array, even things
> that don't look like arrays.
>
>> I found no way, to obtain an empty array of class pn.
> This may be a bug.
>
> - Jordi G. H.
>