Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Just to be clear, you are arguing the superiority of partial application/currying here right?

Because your F# example is the same except it's trading Func<List<int>, List<int> for (int list -> int list)



Technically its passing 'a list -> 'a list, and only becoming an int array because thats the final input value. The fsharp functions are closer to the C# functions Func<List<IComparable>, List<IComparable>>


Or to be even more pedantic it's

Func<T[], T[]> where T : IComparable<T>

But maybe all of that is just stronger arguments for F#'s inferred typing...


Or to be even mooooooore pedantic the fsharp functions would probably be written to be seq<'a> -> seq<'a>, so that would be Func<IEnumerable<T>, IEnumerable<T>> where T : IComparable<T> :)


I think I just tried to say that I didn't specifically intend to write very verbose C# to make a point. I tried to write good real world production C# and then compare it to how I have seen people do DI in real world F#, which is partial application in this case. There is other ways of doing it too, but this is the most common pattern I've seen.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: