Re: TIB: REAL TOPIC!!!! Working W/lists


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

Re: TIB: REAL TOPIC!!!! Working W/lists





> Okay, BASIC dudes, solve me this:
> If I have thre[e] lists:
> L1  L2  L3
> 1    0   0
> 2    0   0
> 3    0   0
> 4    0   0
> 5    0   0
> 
> what is the fastest way to take the top NONZERO item from one list
> and put it at the lowest ZERO spot on another.
> eg.

Do you mean, something that takes the following steps?
Your example doesn't make any sense.

L1 to L2 ->  L1 to L3 ->  L2 to L3 ->  L1 to L2

L1 L2 L3 ->  L1 L2 L3 ->  L1 L2 L3 ->  L1 L2 L3 ->
0  0  0      0  0  0      0  0  0      0  0  0
2  0  0      0  0  0      0  0  0      0  0  0
3  0  0      3  0  0      3  0  0      0  0  0
4  0  0      4  0  0      4  0  1      4  0  1
5  1  0      5  1  2      5  0  2      5  3  2

L3 to L2?

> L1 L2 L3
> 0  0  0
> 0  0  0
> 0  0  0
> 4  1  0
> 5  3  2
> 
Let's see... Now, if I wanted to get the first non-zero number off L1 
and put it on the last zero in L3, I will need to test each element in 
L1 until I no longer find a zero, test each element in L3 until the 
curreent element is the last zero in L3, store the number from L1 to 
that element in L3, and replace the number in L1 with a zero.  Note 
errors will occur if you take a number from a list of zeros or to a list 
without zeros.

Please tell us if this assumption is wrong (although it probably won't 
stop people from trying this anyway), and which calc you are 
programming.

Tavis

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


Follow-Ups: