Skip to content

Instantly share code, notes, and snippets.

@kazumalab
Created January 30, 2017 14:30
Show Gist options
  • Save kazumalab/065c6997ef863bad4bf95ad1a5ce271a to your computer and use it in GitHub Desktop.
Save kazumalab/065c6997ef863bad4bf95ad1a5ce271a to your computer and use it in GitHub Desktop.
using System.Collections.Generic;
public class Functor {
public static List<T> map<T> (System.Func<T, T> f, List<T> list) {
List<T> newList = new List<T> ();
foreach (var num in list) {
newList.Add (f (num));
}
return newList;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment