libcore: Change `each_val` to follow new for-loop protocol