logical AND for filter runs

49 views
Skip to first unread message

Jean-Pierre Rivière

unread,
Jun 16, 2021, 4:36:47 AM6/16/21
to TiddlyWiki
I've been into toying with run prefixes for my filters, to see what I can now do with them.

I've been able to have an equivalent of "if not A then B" but I've not been able to get "if A then B". the + or :and prefix is not a logical AND at all but just a way to replace all currents stuff in the pipe with new contents.

Part of the problem is I can't produce NOT A. I mean, see this example:

{{{
cobalt great gaz :filter[split[]match[r]] 
+[!is[blank]then[]else["great" void]]
~Expected
}}}

{{{
cobalt fox gaz :filter[split[]match[r]] 
+[!is[blank]then[]else["fox" void]]
~Unexpected
}}}

The only output is "fox" void. I expected that the first filter output be Expected.

As a kind of check with

{{{
cobalt great gaz :filter[split[]match[r]] 
~Expected
}}}

{{{
cobalt fox gaz :filter[split[]match[r]] 
~Unexpected
}}}

the output is
great
Unexpected
which is totally what we thought we should have.

The same also happens with

cobalt great gaz :filter[split[]match[r]]
+[!is[blank]]
~Expected
}}}

{{{
cobalt fox gaz :filter[split[]match[r]]
+[!is[blank]]
~Unexpected
}}}

Again, that's OK. Maybe that's because [] is not a blank input? But 


{{{ [[]] +[!is[blank]then[Full]else[Empty]] }}}

does indeed output Empty as expected so I'm really confused now...

BTW, in real life, in "if A then B" my B is not a constant, in which case I would have used [A]!is[blank]then[B] but a complex run. I know I can have a function or variable as my B to get around the difficulty, but that is not what I want to do here.

-- 
Jean-Pierre


Soren Bjornstad

unread,
Jun 16, 2021, 8:19:44 AM6/16/21
to TiddlyWiki
I think you may be looking for :intersection?
  • named prefix :intersection replaces all filter output so far with titles that are present in the output of this run, as well as the output from previous runs. Forms the input for the next run.  NEW IN: 5.1.23
See the examples for filter runs for a full explanation of the difference.
Reply all
Reply to author
Forward
0 new messages