Re: Dimension of sequences
- Posted by Igor Kachan <kinz at peterlink??u> Sep 24, 2007
- 668 views
Fernando Bauer wrote: > > Igor Kachan wrote: > > > > > > Here, in Russia, we use 2 words for these things: > > > > "izmerenie" -- it is just single "dimension" > > > > and > > > > "razmernost'" -- it is common number of dimensions, "dimensionality". > > > > So I'd prefer to say that any sequence has dimensionality 2, > > > > and its dimensions are named as "length" and "depth". > > > > > > This looks ok to me, except that the length is really a very special case. > > > > > > > But this 2-dimensional sequence can describe and contain > > > > multi-dimensional objects. > > > > Anyway, in machine memory, it is just 1-dimensional *range* of > > > > addresses. > > > > > > > > > > Exactly. So the "length" of a general sequence would be the total number > > > of > > > nodes it holds. The current definition of length() is very adequate for > > > linear > > > trees - one root with length(s) children, the nature of which is not taken > > > into > > > account -. For general trees, however, it barely makes sense. > > > > OK, let's see what is every atom in some complicated sequence. > > I think, that every atom can be, so to say, one of the dimensions > > or coordinates of some multi-dimensional object, described by that > > given sequence. > > So the common number of atoms of some given sequence is very > > interesting thing - it gives us sometimes the number of > > dimensions of the described object! > > A possibility is with this type of structure: {A1,{A2,{A3,{...}}...}. > Example: {1,{2,{3,{4}}}} Ok, there may be many examples for different objects, I think. The thing is that the author of the described object wants to tell us how many parameters of his object can be *considered as dimensions*. > > We can name this parameter with some suitable word to > > characterize, so to say, a volume of a sequence, or its > > capacity or something. > > It is not the sum of all lengths, it is number of atoms, > > and a function for calculation of this number may be > > very simple. > }}} <eucode> > function NumberOfAtoms(object o) > integer n > if atom(o) then return 1 end if > n = 0 > for i=1 to length(o) do > n += NumberOfAtoms(o[i]) > end for > return n > end function > <\eucode> It works for me nicely, thanks! Regards, Igor Kachan kinz at peterlink.ru