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

I don't really know Java, but .flatMap(...) seems to be equivalent to C# .SelectMany(...) which famously can be interpreted as a monadic bind operator.

The C# query syntax

  from x in xs
  from y in GetYs(x)
  from z in GetZs(y) ...
is equivalent to

  xs.SelectMany(x => GetYs(x).SelectMany(y => GetZs(y).SelectMany(z => ...)))
which is similar to monadic do-notation in Haskell.

So since there is monadic Scala code elsewhere in the project, I wonder if this is a result of someone thinking in Scala and translating it into Java in their head.



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

Search: