|
![](/i/fill.gif) |
Chris Huff <chr### [at] mac com> wrote:
: Another possibly useful feature would be the ability to use variables in
: the function
And conditional evaluation and recursive functions.
When all those three are supported, it will be possible to make fractal
functions (such as mandelbrot, julia... almost any).
Of course it would need some optimization so that it will not take huge
amounts of memory nor time. Tail recursion optimization is one of the most
obvious and most effective.
(For those who don't know, tail recursion optimization means that if the
recursive call is the last thing in the function, then the this call doesn't
internally generate a new function call (putting parameters in the stack etc),
but it just jumps to the beginning of the function almost as if it was just
a while-loop. For example, this type of function could be something like:
#declare Fact = function { x<1 ? 1 : x*Fact(x-1) }
which calculates the factorial of x; since the recursive call is the last
thing in the function, it can be made as a loop instead of recursive
function calling.)
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
![](/i/fill.gif) |