1...N filters for lists?

52 views
Skip to first unread message

myst...@gmail.com

unread,
Jun 2, 2017, 1:12:41 PM6/2/17
to TiddlyWiki
I have a scenario where i'd like to have a macro take a single number that is # of times to repeat and iterate.

I believe i can use <$list filter="[1 2 3 4 5 6 7]"......  But i really don't wants to have to set that as the arg to the macro.

<<myMacro 5>> is so much nicer than <<myMacro [1 2 3 4 5]>>

Is there a TW5 way to create a numbered list from N to M?

Mark S.

unread,
Jun 2, 2017, 2:41:28 PM6/2/17
to TiddlyWiki
Does it need to be open-ended, or is there some reasonable upper limit? You could use:

\define mac(num)
<$list filter="1 2 3 4 5 6 7 8 9 10 11 12 13 14 +[first[$num$]]"/>
\end

<<mac 5>>

myst...@gmail.com

unread,
Jun 2, 2017, 3:05:57 PM6/2/17
to TiddlyWiki
That will do perfectly!
In my situation, I always know what the max is, or what a reasonable upper limit will be.

Now..l.. just have to try to understand WHY it works :)
Time for me to go re-read the filter pages.

Thank you for the assistance.
Reply all
Reply to author
Forward
0 new messages