Skip to content

Instantly share code, notes, and snippets.

@pietro909
Created May 10, 2016 20:10
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 pietro909/dbebcee9eb0369d377f02f38b03174f0 to your computer and use it in GitHub Desktop.
Save pietro909/dbebcee9eb0369d377f02f38b03174f0 to your computer and use it in GitHub Desktop.
SLISW - IO - 2.4
l = list(1,2,3,4,5)
l average := method(
s := self size;
if(
size==0,
0,
self reduce(+) / size
)
)
l average # => 3
l = list()
l average # => 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment