Map (higher-order function): Difference between revisions

Content deleted Content added
Language comparison: added note about C#
added example for C#
Line 29:
* <code>fmap id = id -- identity</code>
* <code>fmap (f . g) = fmap f . fmap g -- composition</code>
 
 
==Mapping in .NET Procedural Languages==
The map function in .NET Procedural languages like C# or VB.NET (as of C# 2.0 and VB 8.0) is supported through the [http://msdn2.microsoft.com/en-us/library/73fe8cwf.aspx ConvertAll method] of the generic list type,
[http://msdn2.microsoft.com/en-us/library/6sh2ey19.aspx
System.Collections.Generic.List<T>].
 
<source lang="csharp">
System.Collections.Generic.List<int> Values = new System.Collections.Generic.List<int>() { 7, 13, 4, 9, 3 };
var foo = Values.ConvertAll((d) => { return d*d; }) ;
// foo is of type System.Collections.Generic.List<Int32>
</source>
 
==References==