An Array of Challenges #3: Moving Averages Note: This is #3 in a series of array-manipulation challenges. For the previous challenge, click here.

Moving Average of a List


  The moving average of a list is a calculation resulting in a new, smoothed out list, created by averaging small overlapping sublists of the original.


When creating a moving average, we first generate the list of overlapping sublists using a certain 'window size', shifting this window to the right once each time. 

For example, given the list [8, 4, 6, 2, 2, 4] and the window size 3, the sublists would be:

[8,  4,  6,  2,  2,  4]          Sublists:
(         )                  &lt;-  [8, 4, 6]
    (         )              &lt;-  [4, 6, 2]
        (         )          &lt;-  [6, 2, 2]
            (         )      &lt;-  [2, 2, 4]


We then calculate the mean average of each sublist to obtain the result: [6.0, 4.0, 3.3, 2.7] (each value rounded to one decimal place).



The Challenge

Your task is to write a program or function which, given a list L, and an integer 1 ≤ n ≤ length(L), calculate the moving average for L using the window size n.

Rules:


Your program may use integer division or float division. In the case of float division, small inaccuracies due to the data type's limitations are permitted, as long as the value is otherwise correct.
You may submit a full program, or a function (but not a snippet).
You may assume that the list will only contain positive integers.
Standard loopholes are forbidden.
This is code-golf, so the shortest answer (in bytes) wins!




Test Cases

Note that, for ease of readability, all values are rounded to one decimal place.

n=5, [1, 2, 3, 4, 5, 6, 7, 8]      -&gt;      [3, 4, 5, 6]
n=3, [100, 502, 350, 223, 195]     -&gt;      [317.3, 358.3, 256]
n=1, [10, 10, 10]                  -&gt;      [10, 10, 10]
n=3, [10, 20, 30]                  -&gt;      [20]
n=2, [90, 40, 45, 100, 101]        -&gt;      [65, 42.5, 72.5, 100.5]
Dyalog APL, 4 bytes

1 byte saved thanks to @Graham

2 bytes saved thanks to @jimmy23013

Did I mention APL is not a golfing language?

⊢+/÷


with n on the right, or

+/÷⊣


with L on the right.

Try it online!

How?

÷ - divide L by n

⊢+/ - reduce + on windows of n