Your function binomial
returns the result of Array2.update
, which is a unit
. But you're passing this return value in to Array2.update
as the last argument, which is expecting an int
.
EDIT: Oh, now I see... Your only problem is that the last line (Array2.sub(DP,m,n)
) isn't part of your function - if you want to build a list of expressions, you need to surround it with brackets. So instead of
fun binomial (m,n,DP) = <update logic>; Array2.sub(DP,m,n)
you want
fun binomial (m,n,DP) = (<update logic>; Array2.sub(DP,m,n))