先日面白い記事を読んだ。The Y combinator in Go with generics である。 一番最初目に入ってきたのは難解なジェネリクスのコードである。 type Func[T, U any] func(T) U type TagFunc[T, U any] func(Func[T, U]) Func[T, U] type CombinatorFunc[T, U any] func(CombinatorFunc[T, U]) Func[T, U] func Y[T, U any](f TagFunc[T, U]) Func[T, U] { return func(self CombinatorFunc[T, U]) Func[T, U] { return f(func(n T) U { return self(self)(n) }) }(func(self Combinat