3 ms·
I started writing an explanation about how nested functions are great, but at some point you stop making a distinction between `val a: A` and `val a: A => B` in
by nullspace 11y ago
I started writing an explanation about how nested functions are great, but at some point you stop making a distinction between `val a: A` and `val a: A => B` in the scope of a def.
A bunch of my code is interspersed with these function vals. It's useful when within a function when you repeatedly apply the same transformation in multiple places. It kinda makes the code easier to read once you stop making that distinction.
re:short functions - I am not as much in favor of them as I used to be before. IMO, splitting functions into smaller ones are fine as long as there is some "meaning" to splitting them ( mostly related to your domain logic ). But I have stopped splitting functions just to make it smaller. When your code is referentially transparent, I think the size of your function really matters less.