Variadic fixed-point combinator: Difference between revisions
Content added Content deleted
(New post.) |
m (Minor code improvement.) |
||
Line 168: | Line 168: | ||
} |
} |
||
private static interface |
private static interface MetaFunction<T> extends Function<MetaFunction<T>, T> { } |
||
private static <T, R> Function<T, R> yCombinator(Function<Function<T, R>, Function<T, R>> function) { |
private static <T, R> Function<T, R> yCombinator(Function<Function<T, R>, Function<T, R>> function) { |
||
MetaFunction<Function<T, R>> metaFunction = w -> function.apply( x -> w.apply(w).apply(x) ); |
|||
return |
return metaFunction.apply(metaFunction); |
||
} |
} |
||