@@ -82,4 +82,49 @@ default Fn4<B, A, C, D, E> flip() {
8282 default Fn3 <Tuple2 <A , B >, C , D , E > uncurry () {
8383 return (ab , c , d ) -> apply (ab ._1 (), ab ._2 (), c , d );
8484 }
85+
86+ /**
87+ * Static factory method for wrapping a curried {@link Fn1} in an {@link Fn4}.
88+ *
89+ * @param curriedFn1 the curried fn1 to adapt
90+ * @param <A> the first input argument type
91+ * @param <B> the second input argument type
92+ * @param <C> the third input argument type
93+ * @param <D> the fourth input argument type
94+ * @param <E> the output type
95+ * @return the Fn4
96+ */
97+ static <A , B , C , D , E > Fn4 <A , B , C , D , E > fn4 (Fn1 <A , Fn3 <B , C , D , E >> curriedFn1 ) {
98+ return (a , b , c , d ) -> curriedFn1 .apply (a ).apply (b , c , d );
99+ }
100+
101+ /**
102+ * Static factory method for wrapping a curried {@link Fn2} in an {@link Fn4}.
103+ *
104+ * @param curriedFn2 the curried fn2 to adapt
105+ * @param <A> the first input argument type
106+ * @param <B> the second input argument type
107+ * @param <C> the third input argument type
108+ * @param <D> the fourth input argument type
109+ * @param <E> the output type
110+ * @return the Fn4
111+ */
112+ static <A , B , C , D , E > Fn4 <A , B , C , D , E > fn4 (Fn2 <A , B , Fn2 <C , D , E >> curriedFn2 ) {
113+ return (a , b , c , d ) -> curriedFn2 .apply (a , b ).apply (c , d );
114+ }
115+
116+ /**
117+ * Static factory method for wrapping a curried {@link Fn3} in an {@link Fn4}.
118+ *
119+ * @param curriedFn3 the curried fn3 to adapt
120+ * @param <A> the first input argument type
121+ * @param <B> the second input argument type
122+ * @param <C> the third input argument type
123+ * @param <D> the fourth input argument type
124+ * @param <E> the output type
125+ * @return the Fn4
126+ */
127+ static <A , B , C , D , E > Fn4 <A , B , C , D , E > fn4 (Fn3 <A , B , C , Fn1 <D , E >> curriedFn3 ) {
128+ return (a , b , c , d ) -> curriedFn3 .apply (a , b , c ).apply (d );
129+ }
85130}
0 commit comments