http://www.alh.net/newlisp/phpbb/viewtopic.php?p=7985
So it should be easy to write a function or macro that does it for a set of functions... However, I quickly got stuck in a morass and only found a way out using a machete:
Code: Select all
(dolist (_smbl '(sin cos tan))
  (set '_f (name _smbl))
  (eval-string (format {(constant (global (sym (string "newLISP-" "%s"))) %s)} _f _f)) ; safe copy
  (eval-string (format {
   (define (my-%s:my-%s) 
   (let
    ((_t (time-of-day))
    (_d (date (date-value) 0 "%%Y-%%m-%%d %%H:%%M:%%S")))
   (apply (string "my-" %s) (args))
   (append-file "/Users/me/desktop/log" (string _d " " (quote %s) " " (sub (time-of-day) _t) "\n")))) ; timing info
  } _f _f _f _f))    
  (set '_s (format {(constant (global (quote %s)) my-%s)} _f _f))
  (eval-string _s)) ; redirect
Interesting question: is it be possible to do this for all built-in newLISP functions?