Skip to content

Instantly share code, notes, and snippets.

@CaglarGonul
Created March 15, 2013 23:04
Show Gist options
  • Save CaglarGonul/5173857 to your computer and use it in GitHub Desktop.
Save CaglarGonul/5173857 to your computer and use it in GitHub Desktop.
map reduce non elegant
def mapReduce(f:Int=>Int,combine: (Int,Int)=>Int, zero:Int)(a:Int,b:Int):Int ={
if(a>b) zero
else combine(f(a),mapReduce(f, combine, zero)(a+1, b))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment