Created
June 27, 2017 10:46
-
-
Save i7an/b98a1f9ea573cded1d5a340978805e05 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
-module(recursion). | |
-export([reduce/3, max/1]). | |
reduce([], _Fn, I) -> I; | |
reduce([X|Xs],Fn,I) -> | |
reduce(Xs,Fn,Fn(I,X)). | |
max([X|Xs]) -> reduce(Xs, fun erlang:max/2, X). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment