Generalize length() in inspiration code