Created
September 1, 2017 15:14
-
-
Save rubberduck203/cea614a57e61922d92fc6d9a170abbed to your computer and use it in GitHub Desktop.
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
def map = { collection, f -> | |
def result = [] | |
collection.each { element -> | |
result.add(f(element)) | |
} | |
result | |
} | |
def reduce = { collection, accumulator, f -> | |
def result = accumulator | |
collection.each { element -> | |
result = f(result, element) | |
} | |
result | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment