TW 5.3.0 introduced functions and they can be used in a recursive manner. I tried to implement the Fibonacci sequence (already impletemted in TW by @Mark_S. See TW-Scripts) using functions as below
\function .step(n) [<n>subtract[1]]:map[.f<currentTiddler>][<n>subtract[2]]:map[.f<currentTiddler>]:and[sum[]]
\function .f(n) [<n>match[0]then[0]] [<n>match[1]then[1]] :else[.step<n>]
<<.f 6>>
But I failed, using large number like 10 makes Tiddlywiki unresponsive!
EDITED
-
The problem solved. See below solution. The issue was with
:map
. It processes all comming input from previous filter runs. I had to use:map
in.step
only one time. -
You can try the above code in TiddlyWiki Pre-release — 5.3.0-prerelease