final HAppend<HCons<Boolean, HNil>, HCons<Double,
HCons<String, HCons<Integer[], HNil>>>, HCons<Boolean,
HCons<Double, HCons<String, HCons<Integer[], HNil>>>>> one = append(zero);
It's here that I miss the repurposed auto keyword of C++ to do some rudimentary type inference. final boolean b = a.exists(new F<String, Boolean>() {
public Boolean f(final String s) {
return fromString(s).forall(isLowerCase);
}
});
It's here that I miss lambdas to make functional code at all readable.val b = a.exists(str=>str.forall(_.isLowerCase))
or
val b = a.exists(x=>x.toLowerCase() == x)
There's no way I'd start using functional programming in Java if it's this clunky. Just stick with Scala.
boolean b = a.any(λ(s, s.equals(s.toLowerCase()));
s and λ are statically imported.
For type inference, you just need a sufficiently smart compiler, although it's much more useful if your language knows about generic types.
I never used F# before .NET 2.0, but the techniques it used on 1.x could be interesting -- I'll see if I can find some old documentation...
Edit: There used to be a paper describing the technique. I can't find it now, but here's an old Don Syme announcement related to it: http://www.mail-archive.com/dotnet-rotor@discuss.develop.com...
http://projectlombok.org/features/val.html
I find it frustrating that these guys can hack in "val" but JDK7 has token crap like the "diamond operator".