News for hackers. Stuff that matters.
Re:The Y Combinator in Go with generics by _old_dude_ on Sunday June 12, 2022 @02:50PM (#31717153)
It has practical value, let say you have something that caches the result of a lambda

  record Cache<T, U>(Function<T, U> function) {
    U get(T value) { ... }
  }
you can use it that way

  var cache = new Cache<Integer, Integer>(v -> v + 1);
  var result = cache.get(3);
with that settings, how do you specify a lambda which is recursive ? and how can you cache the intermediary steps if you can change the signature of get() ?
Re:The Y Combinator in Go with generics by wyufro on Sunday June 12, 2022 @03:27PM (#31717447)
In languages with closures it would be easy to set a variable to the lambda while that same variable is also captured by the lambda. In fact, this seems to happen once in a while in Go, since closures are always lambdas.