Created
May 10, 2016 20:10
-
-
Save pietro909/dbebcee9eb0369d377f02f38b03174f0 to your computer and use it in GitHub Desktop.
SLISW - IO - 2.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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