Currying in scala -


w.r.t currying in scala, partly understood below sample code.

  def product1(f:int => int )(a:int, b:int):int = {         println()         if(a > b ) 1         else         f(a) * product1(f)(a+1, b)       }   product(x => x * x) (3, 4) 

out of it., bit confused with

product1(f)

in

product1(f)(a+1, b) 

just need explanation, goes on here.... :( , how pronounce verbally while explaining...

thanks in advance..

product1 has 2 parameter lists. product1(f) application of f function of kind int => int. if call product1(f) so:

product1(f) 

without second parameter list, you'd so-called partially-applied function, i.e. function doesn't have of parameters bound (you'd still need provide a , b)


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -