Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Why foldRight is beautiful

Why foldRight is beautiful

Explains why "foldRight" is beautiful.

Jun Tomioka

July 18, 2018
Tweet

More Decks by Jun Tomioka

Other Decks in Technology

Transcript

  1. M3, Inc. Jun Tomioka Twitter: @jooohn1234 Github: jooohn Love: Our

    very first baby Had great paternity leave!
  2. A A A A A List[B] A A A A

    OP ... List[B] List[B]
  3. A A A A A List[B] A A A A

    List[B] List[B] OP ...
  4. Why foldRight is beautiful • Immutable recursive data structure is

    built from smaller part to bigger part • In this sense, foldRight folds items from smaller part to bigger part rather than from right to left ◦ Is quite natural to treat immutable recursive data structure