[racket] Call-Site Code Replacement

From: Jan Burse (janburse at fastmail.fm)
Date: Mon Oct 22 13:55:36 EDT 2012

Dear All,

I just wonder whether it is possible in a functional
language to do call site replacement. I envision this
as a special form of lazyness.

Basically I would call somewhere a function f
with an argument a:

     ... (f a) ...

The function would then manage to replace itself
by a function g with an argument b:

     ... (g b) ...

So that the next time the original call site of (f a)
is invoked in fact (g b) is invoked.

Hints welcome.


Posted on the users mailing list.