From: Robert Redelmeier on
In alt.lang.asm [FUp set] Keith Thompson <kst-u(a)mib.org> wrote in part:
> "Daniel T." <daniel_t(a)earthlink.net> writes:
>> I seriously proposed it. I think it is the best solution
>> for the job (not your code specifically of course, but
>> the idea of a single loop traversing a single container.)
>
> Can a container contain another container, which in turn
> contains another container? If so, isn't a nested loop
> the most natural way to traverse the elements?


Natural, perhaps. Not necessarily the most efficient.
Index calculations can be a significant component of multiply
nested structures [multi-d arrays]. For many operations,
the order of processing is unimportant so why not rip through
it in memory order rather than a big game of RAM hopscotch?


-- Robert


From: Daniel T. on
Keith Thompson <kst-u(a)mib.org> wrote:
> "Daniel T." <daniel_t(a)earthlink.net> writes:
> > Nick Keighley <nick_keighley_nospam(a)hotmail.com> wrote:
> > > On 6 May, 08:50, Keith Thompson <ks...(a)mib.org> wrote:
> > >
> > > > The original problem is to traverse a 3-dimensional array.  A triple
> > > > nested loop is the most obvious way to do that.  There might be
> > > > some advantages in converting it to a single loop, but clarity
> > > > isn't one of them, at least in this case.
> > >
> > > I considered submitting a single loop solution as a joke. It never
> > > crossed my mind someone would seriusly propose it!
> >
> > I seriously proposed it. I think it is the best solution for the job
> > (not your code specifically of course, but the idea of a single loop
> > traversing a single container.)
>
> Can a container contain another container, which in turn contains
> another container? If so, isn't a nested loop the most natural way to
> traverse the elements?

Then you would need an infinite number of find functions, one for each
dimension count. (i.e., a find for 1D arrays, a find for 2D arrays, a
find for 3D arrays, a find for 4D arrays, etc.) That's silly.

http://en.wikipedia.org/wiki/Zero_One_Infinity
From: wolfgang kern on

Nathan tried to convince HLL-folks :)

....

> Please pardon any butchering of C++ syntax in my pseudo snippet above
> -- I totally lack any C++ training. But we alt.lang.asm folk *do*
> have an inkling of how to actually code our way out of a paper bag...
> I do believe.

Ok Nate, we had enough discussions on this matter since HLLs
entered our progamming world ...
We better give up arguing and let the 'faster' programmers
be proud of their 'maintainable/foolproof-readable' sources
which are awful detours with "abstraction layers" while the
few hardware freaks like me work on "really existing things" :)

I don't like to start a war of flames or to pick on any
programmers choice for HLL. But there might be a good
reason for Asm-groups are apart from c/c+-/etc..-groups.

__
wolfgang
I don't 'believe', but I 'know !'
(now at least how my code affects any given hardware)



From: Lie Ryan on
On 05/08/10 04:33, Daniel T. wrote:
> Keith Thompson <kst-u(a)mib.org> wrote:
>> "Daniel T." <daniel_t(a)earthlink.net> writes:
>>> Nick Keighley <nick_keighley_nospam(a)hotmail.com> wrote:
>>>> On 6 May, 08:50, Keith Thompson <ks...(a)mib.org> wrote:
>>>>
>>>>> The original problem is to traverse a 3-dimensional array. A triple
>>>>> nested loop is the most obvious way to do that. There might be
>>>>> some advantages in converting it to a single loop, but clarity
>>>>> isn't one of them, at least in this case.
>>>>
>>>> I considered submitting a single loop solution as a joke. It never
>>>> crossed my mind someone would seriusly propose it!
>>>
>>> I seriously proposed it. I think it is the best solution for the job
>>> (not your code specifically of course, but the idea of a single loop
>>> traversing a single container.)
>>
>> Can a container contain another container, which in turn contains
>> another container? If so, isn't a nested loop the most natural way to
>> traverse the elements?
>
> Then you would need an infinite number of find functions, one for each
> dimension count. (i.e., a find for 1D arrays, a find for 2D arrays, a
> find for 3D arrays, a find for 4D arrays, etc.) That's silly.

I've never heard of any programming languages that doesn't support
recursion.
From: Lie Ryan on
On 05/08/10 10:39, Lie Ryan wrote:
> On 05/08/10 04:33, Daniel T. wrote:
>> Keith Thompson <kst-u(a)mib.org> wrote:
>>> "Daniel T." <daniel_t(a)earthlink.net> writes:
>>>> Nick Keighley <nick_keighley_nospam(a)hotmail.com> wrote:
>>>>> On 6 May, 08:50, Keith Thompson <ks...(a)mib.org> wrote:
>>>>>
>>>>>> The original problem is to traverse a 3-dimensional array. A triple
>>>>>> nested loop is the most obvious way to do that. There might be
>>>>>> some advantages in converting it to a single loop, but clarity
>>>>>> isn't one of them, at least in this case.
>>>>>
>>>>> I considered submitting a single loop solution as a joke. It never
>>>>> crossed my mind someone would seriusly propose it!
>>>>
>>>> I seriously proposed it. I think it is the best solution for the job
>>>> (not your code specifically of course, but the idea of a single loop
>>>> traversing a single container.)
>>>
>>> Can a container contain another container, which in turn contains
>>> another container? If so, isn't a nested loop the most natural way to
>>> traverse the elements?
>>
>> Then you would need an infinite number of find functions, one for each
>> dimension count. (i.e., a find for 1D arrays, a find for 2D arrays, a
>> find for 3D arrays, a find for 4D arrays, etc.) That's silly.
>
> I've never heard of any programming languages that doesn't support
> recursion.

except for assembly, perhaps... or some very ancient or jokular languages