hlearn now compiles and is correct; still more work to make sure it's fast