ID:161348
 
Suppose I have a

var/list/numbers = list(a,b,c)

How would I design a proc that would multiply each and every number in the list by each other?

The result in that case, for example, would be

ab, ac, bc.

Thanks for reading!

~Gooseheaded
Gooseheaded wrote:
Suppose I have a

var/list/numbers = list(a,b,c)

How would I design a proc that would multiply each and every number in the list by each other?

The result in that case, for example, would be

ab, ac, bc.

You left out the squares.

Since presumably you don't want the same multiple included twice (e.g., b*c == c*b), this would be your best bet:

proc/MultiplyListItems(list/L)
. = list()
for(var/i=1, i<=L.len, ++i)
for(var/j=i, j<=L.len, ++j)
. += L[i] * L[j]


Lummox JR
In response to Lummox JR
Thanks a lot.
Worked quite well.
Sorry for "making" you think of this, heheh!
Thanks again!