int? max(int Function(T) selector) { if (isEmpty) { return null; } return skip(1) .fold(selector(first), (prev, next) => math.max(prev!, selector(next))); }