This preview shows page 1. Sign up to view the full content.
Unformatted text preview: function will receive when it is called. Jess> (defadvice before + (bind $?argv (create$ $?argv 1))) TRUE Jess> (+ 2 2) 5 This makes all additions equal to 1. By returning, the defadvice keeps the real function from ever being called. Jess> (defadvice before + (return 1)) TRUE Jess> (+ 2 2) 1 This subtracts one from the return value of the + function. ?retval is another magic variable - it's the value the real function returned. When we're done, we remove the advice with undefadvice . Jess> (defadvice after + (return (- ?retval 1))) TRUE Jess> (+ 2 2) 3 Jess> (undefadvice +) Jess> (+ 2 2) 4...
View Full Document
- Spring '10