/** * Creates a closure with a single free variable and binds it to the current thread * @param type1 The type of the free variable of the newly created closure * @return The newly created closure */ public static <A> Closure1<A> createClosure(Class<A> type1) { Closure1<A> closure = new Closure1<A>(); CLOSURES.set(closure); return closure; }
/** * Curry this closure by fixing its first free variable to a given value. * @param curry The value to which the first variable should be curry * @return A Closure having a single free variable */ public Closure1<B> curry1(A curry) { return curry(new Closure1<B>(), curry, 1); }
/** * Curry this closure by fixing its second free variable to a given value. * @param curry The value to which the second variable should be curry * @return A Closure having a single variable */ public Closure1<A> curry2(B curry) { return curry(new Closure1<A>(), curry, 2); }