octave/av.m

function a = av(n)
  global sm = 0
  global cnt = 0
  cnt +=1
  sm += n
  a = sm/cnt
endfunction