News for hackers. Stuff that matters.
Re:Cursed Elixir by dkarl on Monday October 19, 2020 @08:56AM (#24825875)
I think I'm in between somewhere. I do love named intermediate results as documentation. I love that functional code composes so well that you don't have to give names to every value... but I hate when people abuse it to eliminate all names.

Oftentimes, if I have a one or two line function that is only used in one place, I prefer to have it inline and use a named intermediate value to document its meaning.

  grades_with_end_of_semester_adjustment = grades.map(x => 
    code code code
      code code code code code
  )

  odd_adjusted_grades = grades_with_end_of_semester_adjustment.filter(x => 
    x % 2 != 0
  )

There are no comments on this comment yet.