finish ex 5.7 and fix bug in machine.lisp