Alexander Lopatin
Alexander Lopatin

Reputation: 582

Scala: default value for function parameter in higher order function

I have higher order function:

def calculateFusionRiskContract(postCalc: DataFrame => DataFrame) 

How i can set default value for postCalc parameter that just return parameter of postCalc? without any calculation?

def calculateFusionRiskContract(postCalc: DataFrame => DataFrame = ???) 

Upvotes: 0

Views: 83

Answers (1)

Dmytro Mitin
Dmytro Mitin

Reputation: 51683

The function that "just returns the parameter" is identity

def calculateFusionRiskContract(postCalc: DataFrame => DataFrame = identity) = ???

Is there a scala identity function?

Upvotes: 6

Related Questions