News for hackers. Stuff that matters.
Re:Ask HN: What change in your programming technique has bee... by hnruss on Thursday January 23, 2020 @04:44PM (#22132519)
Functional Programming fundamentally changed the way that I solve problems. It also changed my expectations for how code should be designed.

The concepts that influenced me the most were immutability and the power of mapping+filtering. Whenever I read a for/while loop now, I’ll attempt to convert it to the FP equivalent in my head so that I can understand it better.

Re:Ask HN: What change in your programming technique has bee... by richardknop on Friday January 24, 2020 @05:36PM (#22143067)
I’d do the complete opposite. Instead of using mapping and filters I’d prefer for loops.
Re:Ask HN: What change in your programming technique has bee... by alexanderscott on Friday January 24, 2020 @01:31AM (#22135872)
map and filter are not concepts of FP - they are just syntactic sugar around for loops. fully evident if you check any native source code. many languages (such as go which I currently use) do not even have these functions but can apply FP. this is by design of simplicity and visibility: it does not get much easier to read than a simple for loop and know the exact iterations count at runtime.
Re:Ask HN: What change in your programming technique has bee... by monsieurbanana on Friday January 24, 2020 @01:56AM (#22135977)
One of the key principles of functional programming is, well, functions. A for loop isn't a function and isn't composable, map and filter are.
Re:Ask HN: What change in your programming technique has bee... by js8 on Friday January 24, 2020 @03:33AM (#22136424)
They are not equivalent - for loop prescribes the ordering of processing, but map and filter can work in any order. They are often associated with FP because to define these operators, you need to be able to pass functions as parameter to other functions, which is a thing that surprisingly many languages struggle with.
Re:Ask HN: What change in your programming technique has bee... by diehunde on Tuesday January 28, 2020 @11:25AM (#22170823)
That's like saying SQL is just syntactic sugar around loops for databases. Might be true but it misses the whole point of declarative programming.