rejetto forum
Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: rejetto on April 02, 2008, 04:02:23 AM
-
This is for those interested in programming with template macros.
I made this for fun, to test the capabilities of this shitty language. :)
Fibonacci is a function of numbers http://en.wikipedia.org/wiki/Fibonacci_number
And this is how to get it with macros
{.set|fib|{:
{.if|{.$1 <= 1.}
| $1
| {: {.add| {.^fib|{.sub|$1|1.}.} | {.^fib|{.sub|$1|2.}.} /add.} :}
/if.}
:}.}
to make a test, you can try {.^fib|10.}
I tried even with 20, it takes forever, but the result is correct.
Extra note: this recursive way is highly inefficient.
-
In when macro for the square matrices of order N? ;D ;D