concept output in category f#

appears as: output, output, The output, outputs, outputs
Get Programming with F#: A guide for .NET developers

This is an excerpt from Manning's book Get Programming with F#: A guide for .NET developers.

Listing 0.2  Imperative and Declarative code samples in C# and F#
IEnumerable<int> GetEvenNumbers(IEnumerable<int> numbers) { var output = new List<int>(); #1 foreach (var number in numbers) { #2 if (number % 2 == 0) #3 output.Add(number); } #4 return output;} let getEvenNumbers = Seq.filter(fun number -> number % 2 = 0) #5 #1 : Temporary collection to store output #2 : Manual iteration through collection #3 : Actual filter logic #4 : Manual addition to output collection #5 Focus on business logic.
  • The output is a list of 'U that has been mapped.
  • Figure 16.1. Mapping from a Person list to a String list

    The direct equivalent to this in terms of LINQ is Select(). A common approach to performing the same operation with a loop is to first manually create an empty output collection, write a for loop to iterate over the collection, and manually populate the output collection with the output of every mapped item.

    That’s about it for this lesson! I hope you’re able to see that the F# collection modules have a wide range of powerful functions. At the risk of repeating myself, go through all these examples yourself, executing all the pipelines incrementally; execute just the first line, then the first two lines, and so forth, and observe the outputs in FSI.