Oh! My god. I made a mistake.
io:format("request=~p, state=~p ~n", [Response, NewState]).
The above statement is right. However, you must notice the last argument is a list, I wrote the following.
io:format("request=~p, state=~p ~n", Response, NewState).
The habit is from the function printf() in C language.