Hacker News new | ask | show | jobs
by andolanra 5114 days ago
They found me again at

  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.