News for hackers. Stuff that matters.
Re:What Learning APL Taught Me About Python by banashark on Thursday August 17, 2023 @01:57PM (#37165598)
The concise reduce is fairly small:

    ages.reduce((a, c) => (a + (c > 18)), 0)
Though usually in production code you'll see this as something like

    ages.reduce((acc, cur) => {
      return acc + c > 18 ? 1 : 0
    }, 0)
Which creates some more noise but ups readability

There are no comments on this comment yet.