Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

/prog/ challenge

Name: Anonymous 2014-07-16 18:35

Write a macro that, given a term of code, transforms all the calls to the function FOO in that term, and only those calls, into calls to function BAR with the same arguments.
Language: Common Lisp or Scheme.

Name: Anonymous 2014-07-18 10:00

>>34
I've given it some thought and I don't believe that a macro is the correct tool to "replace" all function calls of foo to bar. It's not even clear what that means, unless you talk about function pointers. Even though >>32's example can be modified to handle the FUNCALL case, there's more things one can come up with to screw with the macro:

; to demonstrate:
(defun myfuncall ...)
(myfuncall #'foo ...)


Therefore, if anything, the solution used by >>32 is just fine. What >>9 wrote is also fine, only that it has to be used on the macroexpanded AST. Seriously, >>1 trolled us all by posting an ill-imposed problem.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List