This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

Shortcut Filter Run Prefix

 10th July 2023 at 7:44am

Shortcut prefixes are commonly used by advanced users because they are fast to type but they are harder to read by less experienced users. That's why named prefixes have been created, which are more verbose. Shortcut and named filter run prefixes are interchangeable as shown in the table below.

+-~=run

If a run has:

  • no prefix, its output titles are dominantly appended to the filter's output
  • the prefix +, it receives the filter output so far as its input; its output then replaces all filter output so far and forms the input for the next run
  • the prefix -, output titles are removed from the filter's output (if such tiddlers exist)
  • the prefix ~, if the filter output so far is an empty list then the output titles of the run are dominantly appended to the filter's output. If the filter output so far is not an empty list then the run is ignored. Introduced in v5.1.18
  • the prefix =, output titles are appended to the filter's output without de-duplication. Introduced in v5.1.20

Interchangeable Filter Run Prefixes

In technical / logical terms:

RunEquivalent named prefixInterpretationOutput
[run]:or[run]de-duplicated union of sets... OR run
+[run]:and[run]accumulation of filter steps... AND run
-[run]:except[run]difference of sets... AND NOT run
~[run]:else[run]else... ELSE run
=[run]:all[run]union of sets without de-duplication... OR run

The input of a run is normally a list of all the non-shadow tiddler titles in the wiki (in no particular order).
But the + prefix can change this:

PrefixInput
-, ~, =, :intersection or none[all[]] tiddler titles, unless otherwise determined by the first filter operator
+, :filter, :map, :reduce,:sortthe filter output of all previous runs so far

Precisely because of varying inputs, be aware that both prefixes - and + do not behave inverse to one another!

For example, in both of the following, $:/baz will only be removed if it actually exists:

To understand why, consider the input for both final runs with their - prefix.

In order to remove $:/baz in any case, existing or not, simply use the + prefix with negated filter operators:

Difference between + and intersection

For the difference between + and :intersection, see Intersection Filter Run Prefix (Examples).

For Developers

To create a new filter run prefix, create a Javascript module with a module-type of filterrunprefix.