[racket] Search & wrap
You say "wrap" but in your example you replace the call of function b with
another function.
Without a specific use-case I'm not sure about the use of speculating on
your meaning.
Would you be satisfied with
(search&wrap function-b
(define (function-a ...) ...))
or
(define (function-a ...)
(with-function-wrapper ([function-b ...]) ...))
?
Otherwise it seems like you are asking for something that precludes
separate compilation and has effects that cross module boundaries... sounds
unpleasant if not terrible.
Andrew Mauer-Oats
Mathematics Ph.D.
Chicago Public Schools: Whitney Young
On Tue, Feb 24, 2015 at 6:52 AM, Jukka Tuominen <
jukka.tuominen at finndesign.fi> wrote:
>
> 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
>
>
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20150224/4270e77c/attachment.html>