by lexi-lambda · 11y ago · 0 comments
I guess I was just hoping that Haskell, being a more composition-oriented language in many ways, would have some nice built-in to do that for me.
: inexact-matches ( x y -- n )
[ matches ] [ exact-matches ] 2bi - ;
That is, run both “matches” and “exact-matches” on both inputs, then take the difference of the results. If Haskell had functions of multiple parameters and results, 2bi’s type would look like this: (a, b, ((a, b) -> c), ((a, b) -> d)) -> (c, d)