> I can also remember when all of this was alien to me.
The only way to make it the norm is to make it the norm.
Maybe someone sees this...
type Expr =
| Const of int
| CustomOneArg of (int -> int) * Expr
| CustomTwoArgs of (int -> int -> int) * Expr * Expr
...instead of this... interface Expr {
}
class Const extends Expr {
public Integer val;
public (Integer val) {
this.val = val;
}
}
class CustomOneArg extends Expr {
public Function<Integer, Integer> fun;
public int val;
public (Function<Integer, Integer> fun, Integer val) {
this.fun = fun;
this.val = val;
}
}
class CustomTwoArgs extends Expr {
public BiFunction<Integer, Integer, Integer> fun;
public Integer valA;
public Integer valB;
public (BiFunction<Integer, Integer, Integer> fun, Integer valA, Integer valB) {
this.fun = fun;
this.valA = valA;
this.valA = valB;
}
}
... and thinks "I should look into this more".That said, I don't want to put words into the author's mouth, but this particular article looks more "by FPers for FPers" than FP advocacy.