예제 #1
0
파일: Functor.cs 프로젝트: jedahu/Jib
        public NonEmptyLazyList <B> Map <A, B>(NonEmptyLazyList <A> list, Func <A, B> f)
        {
            var ht = list.HeadTail();

            return(f(ht.Fst).Cons(ht.Snd.Select(f)));
        }
예제 #2
0
파일: Bind.cs 프로젝트: jedahu/Jib
        public static NonEmptyLazyList <B> Bind <A, B>(this NonEmptyLazyList <A> list, Func <A, NonEmptyLazyList <B> > f)
        {
            var ht = list.HeadTail();

            return(f(ht.Fst).SemiOp(ht.Snd.Select(f).Aggregate((a, b) => a.SemiOp(b))));
        }
예제 #3
0
파일: Uncons.cs 프로젝트: jedahu/Jib
 public static Maybe <Pair <A, IEnumerable <A> > > Uncons <A>(this NonEmptyLazyList <A> list)
 {
     return(Maybe.Just(list.HeadTail()));
 }