Comment

Comment by drawfloat

Not sure about the timtam example. Couldn't this:

  const flow = (...fns) => x0 => fns.reduce(
    (x, f) => f(x),
    x0
  );

  function slamTimTamsUsingFlow(timtams) {
    return timtams
        .slice(0, MAX_TIMTAMS)
        .map(flow(
            biteArbitraryCorner,
            biteOppositeCorner,
            insertInBeverage,
            drawLiquid,
            insertIntoMouth));
  }
Just be written as:

  const slamTimTams = timtams => 
     timtams
        .slice(0, MAX_TIMTAMS)
        .map(timtam => timtam.biteArbitraryCorner()
            .biteOppositeCorner()
            .insertInBeverage()
            .drawLiquid()
            .insertIntoMouth());
Feels much more concise and readable than the flow example
parent drawfloat 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton