for the record, the course he mentions is free and it's name is "JDK 8 Massive Open and Online Course: Lambdas and Streams Introduction" and it a very good introduction to these topics
At 18:32 from the original sequential Java 7 solution, we see that it will always return the FIRST line of the longest length, in the case of ties (reasonably likely if there are a very large number of lines)...the reduction at 23:20 will always give us the LAST line of the max length in the case of ties, right? Subtle difference, but a drop-in replacement would break a good enough Unit Test? I had to write code to check because Simon is brilliant and I am dense, but yeah, we needed >= if coded as shown at 23:20 to preserve behavior in the face of ties.
Not everyone gets the point of his very funny story. There were real improvements in "getting more functional" until 14:08 or thereabouts, when he said "I am good". That is, there were benefits along the way, until at some point, well along the evolution towards "being more functional" you are solely pursuing ideological Purity.
Excellent talk by Simon as usual...one thing I didnt get is the recursion example solving the problem of removing state,,,which state is being considered in these code example...Can someone please assist..Thanks
Functions by definition do not have state, objects do. When I give you a function and say this function returns true if your input integer is greater than 0 you will get true every single time you call that function with a positive integer. When I say this function will return true if your input is bigger than the previous input you gave it then the result will depend on the previous call you made to the function. I will give it 5 then 10 and I will get true. You will give it 15 and then 10 and despite giving the same input 10 you will get false. This is state. When you called the function it was in a state that would return false to input 10 BUT when I called it at the time it was in a state that would return true to input 10. Once he modified the function as a recursive one he eliminated the state. Rather, he moved the state to the application level out of the function itself.
I think he said an IO Monad, although I'm not entirely sure. If he did say that, some reference on what it is: en.wikipedia.org/wiki/Monad_(functional_programming)#The_I.2FO_monad
@@nicholas1460 Actually both are true. It's originally Observer Effect, applied to systems in general. But Heisenberg used the same in quantum mechanics (sub atomic level) to explain why we can't accurately measure momentum and position of the electrons simultaneously. But later it was proved that in quantum mechanics Observer Effect doesn't apply bcz the sub atomic particles inherently exhibit dual (energy as well matter) property by their very nature. And that's called "Uncertainty Principle" (not Heisenberg's).