Average of 2-D array

new topic     » topic index » view thread      » older message » newer message

I have a two-dimensional sequence of integers (100 in all, arranged 10x10).

Let's call it x.

I can get math:sum(x) easily, it adds them up regardless of nesting. But stats:average(x) doesn't work that way.

I could get the average by dividing the sum by 100,but who knows if the array will always be that size? length(x) does not return the actual number of elements, it returns 10.

/usr/local/share/euphoria/include/std/stats.e:490 in function sum() type_check failure, result_ is {1,2,3,4,5,6,7,8,9,10}

Am I overlooking a function in either math or stats? Or a function to get the actual number of elements in the array?

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu