You lost me at 'public static function main.'
enum Cell<T> { nil; cons(car : T, cdr : Cell<T>); }
class List {
public static function mymap<A, B>(f : A -> B, l : Cell<A>) : Cell<B> {
return switch(l) {
case nil: nil;
case cons(x, xs): cons(f(x), mymap(f, xs));
}
}
}
Some of the Java heritage does seem slightly unpleasant, but interesting features like ML-style tagged enums and structural subtyping for record types mean I'm not going to discount the whole thing just yet.The main function has to be static and will serve as the entrance point of the program, not the class. So this might just look like too much when in fact this is just a very small code sample.
Did I address some of your concerns, or did I miss the point entirely? Just curious.
"static function main()" seems to work as an entrance point, though, which makes sense somehow...
Seriously, if you're prepared to throw out the whole language based on what its syntax resembles, your decision-making process might need a bit of work.