//
// Author:
// Jb Evain (jbevain@gmail.com)
//
// Copyright (c) 2008 - 2015 Jb Evain
// Copyright (c) 2008 - 2011 Novell, Inc.
//
// Licensed under the MIT/X11 license.
//
using System;
using System.Collections.Generic;
namespace MonoFN.Cecil.Rocks {
static class Functional {
public static System.Func Y (System.Func, System.Func> f)
{
System.Func g = null;
g = f (a => g (a));
return g;
}
public static IEnumerable Prepend (this IEnumerable source, TSource element)
{
if (source == null)
throw new ArgumentNullException ("source");
return PrependIterator (source, element);
}
static IEnumerable PrependIterator (IEnumerable source, TSource element)
{
yield return element;
foreach (var item in source)
yield return item;
}
}
}