public static Inert ForEach(Applicative app, List lists) { if (!lists.Any <Object>()) { throw new ArgumentException("Lists list must not be empty"); } Integer starterLength = ListMetrics.Pairs(GetListMetrics(lists[0])); if ((lists[0] as Pair).IsCyclic && lists.Any <List>(list => !list.IsCyclic)) { throw new ArgumentException("A list is cyclic, so they must all be"); } if (lists.Any <Object>(l => ListMetrics.Pairs(GetListMetrics(l)) != starterLength)) { throw new ArgumentException("A list does not have the same length as the others"); } HashSet <List> visitedTuples = new HashSet <List>(); while (lists[0] != null && visitedTuples.Add(lists)) { app.Invoke(lists.Select <Pair>(Car <Object>)); lists = lists.Select <Pair>(Cdr <Pair>); } return(Inert.Instance); }
private static void Apps() { Applicative.Setup(); Applicative.Start(); ConsoleLogger.Log("[apps] ready"); }