Average (J)

From LiteratePrograms

Jump to: navigation, search

We want to define a function, named "avr", to find the average of a vector.


To get the average we need to sum the elements of the vector, and divide it by the number of elements.


We get the sum by inserting the verb "+" between each pair of elements with the adverb "/"