Skip to content

Instantly share code, notes, and snippets.

@grondilu
Last active January 3, 2016 08:49
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 grondilu/8438249 to your computer and use it in GitHub Desktop.
Save grondilu/8438249 to your computer and use it in GitHub Desktop.
sub sma($P) {
sub {
$P R/ do
(state$ ) += $^x -
(state@ = 0 xx $P).push($x).shift
}
}
my &f = sma(3);
for 0, .1 ... 1 {
say &f(.cos)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment