Fizzbuzz and complex filtering

Thank you @jeremyruston for these clear explanations that must be taken into consideration when coding.

In this example I import the myfunctions inside a procedure, and they become available to the procedure;

“import functions” contains

\procedure fizzbuzz(n) 
\import [[myfunctions]]
# <<test hi>>
# <$transclude $variable=test n=<<n>>/>
\end fizzbuzz

<<fizzbuzz 4>>

myfunctions contains

\function test(n) [<n>addprefix[item-]]

Note

  • Although import may not import nested procedures and functions, it accepts a filter which can itself import multiple tiddlers containing definitions
  • However is the following not actualy doing this?

Further given the above;
Reimport contains

\import [[import functions]]

<<fizzbuzz 4>>
  • This works as follows
    • Reimport imports [[import functions]]
    • <<fizzbuzz 4>> works
      • The procedure fizzbuzz is defined in [[import functions]]
      • Inside procedure fizzbuzz we import [[myfunctions]]
      • [[myfunctions]] contains the definition of the test function
1 Like

Great @TW_Tones ! This is what I was looking for. importing inside function is really clever!