[racket] Search & wrap

From: Jukka Tuominen (jukka.tuominen at finndesign.fi)
Date: Tue Feb 24 07:52:04 EST 2015

This is something I've been wondering for years and always ended up doing
it manually. So, why not ask it out loud...

I wonder whether it would be possible to search and wrap all definitions
that reside outside a specified function, other than those contained in
#lang racket?

Say, (search&wrap 'function-a)  would start in the situation like

(define (function-a x y z)
   (function-b x y z))

It would then search the definition for 'function-b and would output
something like

(define (function-a x y z)
   (define function-b +)
   (function-b x y z))

It does not have to search through unintroduced library files (though it
would be even cooler), only starting in a situation where all the needed
definitions can be found within the same level or 'required' from other
files.

It should also work recursively, so that eventually no library calls would
be needed to run the function-a.

Any idea whether this is feasible?

br, jukka




Posted on the users mailing list.