[REBOL] Re: Fun with literal blocks!
From: joel:neely:fedex at: 27-Oct-2000 10:12
Hi, Paul,
[rebol-bounce--rebol--com] wrote:
> How can you reference the function your defining within itself. Is this
> good practice?
>
I'm not sure that I understand the question. If you mean
"How can the definition to Fibon contain calls of Fibon?"
Then I'd answer that this is simply the fact that Fibon is a recursive
function.
If you mean
"Should Fibon be written as self-modifying code?"
then (see my answer to Ladislav's comments on the same post) I'd answer
that there are certainly some pros and cons to SMC. It is certainly a
technique that should be used with care. OTOH, there are some very
elegant things that can be done with functions that either:
* maintain persistent state via SMC (less overhead vs full-blown objects),
* construct and then evaluate code blocks "on the fly", or
* can examine (and modify) their own operation for explanation or
optimization.
The whole history of AI is full of examples of the latter two.
Please let me know if I failed to get your meaning.
-jn-
--
; Joel Neely [joel--neely--fedex--com] 901-263-4460 38017/HKA/9677
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]