Skip to content

Instantly share code, notes, and snippets.

@menduz
Created November 6, 2017 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save menduz/10eceb52fe618af3faf002ddedaf8a45 to your computer and use it in GitHub Desktop.
Save menduz/10eceb52fe618af3faf002ddedaf8a45 to your computer and use it in GitHub Desktop.
DataWeave SMA
%dw 2.0
output application/json
fun sma(list: Array<Number>, window: Number) =
0 to (sizeOf(list) - window) map ($ to $ + window - 1) map avg(list[$])
---
sma([90, 40, 45, 100, 101], 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment