Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by ducaale

3 days ago

I find `reduce` useful for operations where:

- arg1, arg2 and return value are all of the same type e.g `ADD`, `MAX`, `CONCAT` etc

- and there is an identity value e.g zero for `ADD`, -math.inf for `MAX`

I recommend checking this article[1] on how monoids play nicely with reduce.

[1] https://fsharpforfunandprofit.com/posts/monoids-without-tear...

0 comments

ducaale

Reply

No comments yet

Contribute on Hacker News ↗

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities