Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals, Chapter 2 of 13
Oct 08, 2009 at 2:47 PMThe more lovely way with this sort of example is not with a ton of application ($)s, but with the composition operator (.) and one last use of the application operator ($) only, isn't it?
Erik hasn't explained map and \x -> ... x ... , yet but anyway, in your example
what am I doing to the list called xs ? I'm applying this composite function:
Whatever I'm starting with, first I filter out just the primes, then I replace each of the remaining numbers with itself + 17; then I omit all but the first 10 things on my list; then print.
So, to apply this composite function a list, say the first hundred numbers [1..100], you could write:
Of course, since in the end you're going to print the first 10, following what Erik said about laziness and take you'd get the same result if you applied it to the infinite list of all numbers: