// Path: src/main/java/streams/algebras/StreamAlg.java
// public interface StreamAlg<C> {
//     <T> App<C, T> source(T[] array);
// 
//     <T, R> App<C, R> map(Function<T, R> f, App<C, T> app);
// 
//     <T, R> App<C, R> flatMap(Function<T, App<C, R>> f, App<C, T> app);
// 
//     <T> App<C, T> filter(Predicate<T> f, App<C, T> app);
// }
// 
// Path: src/main/java/streams/higher/App.java
// public interface App<C, T> {
// }
// 
// Path: src/main/java/streams/higher/Push.java
// public interface Push<T> extends App<Push.t, T> {
// 
//     static <A> Push<A> prj(App<Push.t, A> app) {
//         return (Push<A>) app;
//     }
// 
//     void invoke(Consumer<T> k);
// 
//     static class t {
// 
//     }
// }


import streams.algebras.StreamAlg;
import streams.higher.App;
import streams.higher.Push;
import java.util.function.Function;
import java.util.function.Predicate;
package streams.factories;



/**
 * Authors:
 * Aggelos Biboudis (@biboudis)
 * Nick Palladinos (@NickPalladinos)
 */
public class PushFactory implements StreamAlg<Push.t> {

    @Override
    public <T> App<Push.t, T> source(T[] array) {
        Push<T> f = k -> {
            for (int i = 0; i < array.length; i++) {
                k.accept(array[i]);
            }
        };
        return f;
    }

    @Override
    public <T, R> App<Push.t, R> map(Function<T, R> mapper, App<Push.t, T> app) {
        Push<R> f = k -> Push.prj(app).invoke(i -> k.accept(mapper.apply(i)));
        return f;
    }

    @Override
    public <T, R> App<Push.t, R> flatMap(Function<T, App<Push.t, R>> mapper, App<Push.t, T> app) {
        Push<R> f = k -> Push.prj(app).invoke(v -> {
// Path: src/main/java/streams/algebras/StreamAlg.java
// public interface StreamAlg<C> {
//     <T> App<C, T> source(T[] array);
// 
//     <T, R> App<C, R> map(Function<T, R> f, App<C, T> app);
// 
//     <T, R> App<C, R> flatMap(Function<T, App<C, R>> f, App<C, T> app);
// 
//     <T> App<C, T> filter(Predicate<T> f, App<C, T> app);
// }
// 
// Path: src/main/java/streams/higher/App.java
// public interface App<C, T> {
// }
// 
// Path: src/main/java/streams/higher/Push.java
// public interface Push<T> extends App<Push.t, T> {
// 
//     static <A> Push<A> prj(App<Push.t, A> app) {
//         return (Push<A>) app;
//     }
// 
//     void invoke(Consumer<T> k);
// 
//     static class t {
// 
//     }
// }


// Path: src/main/java/streams/factories/PushFactory.java
import streams.algebras.StreamAlg;
import streams.higher.App;
import streams.higher.Push;
import java.util.function.Function;
import java.util.function.Predicate;

package streams.factories;



/**
 * Authors:
 * Aggelos Biboudis (@biboudis)
 * Nick Palladinos (@NickPalladinos)
 */
public class PushFactory implements StreamAlg<Push.t> {

    @Override
    public <T> App<Push.t, T> source(T[] array) {
        Push<T> f = k -> {
            for (int i = 0; i < array.length; i++) {
                k.accept(array[i]);
            }
        };
        return f;
    }

    @Override
    public <T, R> App<Push.t, R> map(Function<T, R> mapper, App<Push.t, T> app) {
        Push<R> f = k -> Push.prj(app).invoke(i -> k.accept(mapper.apply(i)));
        return f;
    }

    @Override
    public <T, R> App<Push.t, R> flatMap(Function<T, App<Push.t, R>> mapper, App<Push.t, T> app) {
        Push<R> f = k -> Push.prj(app).invoke(v -> {
            Push<R> inner = Push.prj(mapper.apply(v));