lib/core: fix `List::clear` not setting `length` to 0