SourceForge has been redesigned. Learn more.
Close

#172 Array\\\'s last\\\"-method: add multidimensionality support

v3.2.0
closed
Classes (154)
5
2012-08-14
2007-05-29
No

Now that the array class supports a single-dimension object as an index for multidimensional arrays, the method "last" should support that feature as well.

An implementation to support this feature may look like (tested):

---------------- cut here ---------------
::method last -- single & multidimensional last
d=self~dimension -- get number of dimensions
if d=0 then return .nil -- no dimension yet (result of ".array~new")
if d=1 then return dimension(1)-- return size of single dimension

a=.array~new -- create & return array object
do i=1 to d -- set each index to its dimension's size
a~append(self~dimension(i)) -- use size of dimension in hand
end
return a
---------------- cut here ---------------

Discussion

  • Rick McGuire

    Rick McGuire - 2007-05-29

    Logged In: YES
    user_id=1125291
    Originator: NO

    Committed revision 411.

     
  • Rick McGuire

    Rick McGuire - 2007-06-20

    Logged In: YES
    user_id=1125291
    Originator: NO

    Remove the restriction about LAST only working on single-dimension arrays.

     

Anonymous
Anonymous

Cancel  Add attachments