chickadee » lolevel » mutate-procedure!

mutate-procedure! OLD PROCprocedure

Replaces the procedure OLD with the result of calling the one-argument procedure PROC. PROC will receive a copy of OLD that will be identical in behaviour to the result of OLD:

 ;;; Replace arbitrary procedure with tracing one:

 (mutate-procedure! my-proc
   (lambda (new)
     (lambda args
       (printf "~s called with arguments: ~s~%" new args)
       (apply new args) ) ) )