Skip to content

Instantly share code, notes, and snippets.

@contrun
contrun / wadler-expression-problem-generic-java-code-in-modern-java.java
Last active March 27, 2024 03:49
A failed attempt to port Wadler's original Generic Java solution to expression problem to modern Java
// Wadler's the expression problem email https://homepages.inf.ed.ac.uk/wadler/papers/expression/expression.txt
// introduced the term expression problem and suggested a solution in Generic Java. The code within the email
// actually does not work. Below is Wadler's original words.
// 2. A caveat with regard to inner interfaces
// In GJ as it is currently implemented, type parameters do not scope
// over static members, and further, a type parameter may be indexed only
// by non-static classes or interfaces defined in the bound. And in Java
// as it is currently defined, all inner interfaces are taken as static,
@contrun
contrun / IndexedSeq.scala
Created April 24, 2020 11:41
benchmark for two fold implementation of scala IndexedSeq 'bench/jmh:run -i 10 .*IndexedSeqFoldImplBenchmark.*'
/*
* Scala (https://www.scala-lang.org)
*
* Copyright EPFL and Lightbend, Inc.
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.