This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collection; | |
import java.util.List; | |
import java.util.function.BiFunction; | |
import java.util.function.Function; | |
import java.util.function.Predicate; | |
public class Transducers { | |
static interface Reducer<Something, Input> extends BiFunction<Something, Input, Something> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import java.util.function.BiFunction; | |
import java.util.function.Function; | |
import static java.util.Arrays.asList; | |
public class Combinators { | |
public static <A, B, R> BiFunction<B, A, R> flip(BiFunction<A, B, R> fn) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with recursive generation1(x,y) as ( --the initial board setup | |
select 2, 3 | |
union | |
select 3, 3 | |
union | |
select 4, 3 | |
), | |
game(n, x, y) as ( | |
select 1, x, y from generation1 -- generation 1 is initial board setup | |
union all |