Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
taeric
on March 22, 2022
|
parent
|
context
|
favorite
| on:
Literate programming is much more than just commen...
I typically see "self documenting code" refer to code where function and variable names indicate the code without added comments.
Think:
function square(x) ...
Versus
function f(a) ...
Often includes all functions as named things, with little to no lambda usage, since names are seen as for the programmer, not for the computer.
t0suj4
on March 24, 2022
[–]
Pushing for an extreme can be counterproductive. For example completely avoiding lambda may bring the equivalent of constant abuse.
Compare
list.map(v => v+2)
To
list.map(add2)
In addition to other problems with functions, you now have a potential for combinatorial explosion doing it this way.
taeric
on March 24, 2022
|
parent
[–]
Completely agreed. Though, I suspect cases like that are less common. Small adjustments by constants aren't something I do often, at least. (That is, this is a bit of a straw man.)
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
Think:
Versus Often includes all functions as named things, with little to no lambda usage, since names are seen as for the programmer, not for the computer.