filter, type field and dominant append

40 views
Skip to first unread message

Mohammad

unread,
Feb 10, 2020, 3:59:30 AM2/10/20
to tiddl...@googlegroups.com
<$list filter="[tag[Examples]]">

</$list>

---

<$list filter="[tag[Examples]get[type]] -[[text/vnd.tiddlywiki]]">

</$list>

It displays

"A Thesis Notebook" by Alberto Molina
"PETTIL - Forth for the Commodore PET" by Charlie Hitselberger
Interactive Git Documentation by Devin Weaver
Obadiah TOC
PESpot Lesson Planner by Patrick Detzner
Simple Zork-like Game by Jed Carty
TriTarget.org by Devin Weaver


-------------------------------------------------------------------


text
/vnd.tiddlywiki
text
/vnd.tiddlywiki


Why there is two outputs for second $list while as per dominant append filter concept, if all tiddlers have type text/vnd.tiddlywiki, then second $list should have no output!

Is there any mistake here?


Eric Shulman

unread,
Feb 10, 2020, 4:49:51 AM2/10/20
to TiddlyWiki
On Monday, February 10, 2020 at 12:59:30 AM UTC-8, Mohammad wrote:
<$list filter="[tag[Examples]get[type]] -[[text/vnd.tiddlywiki]]">

</$list>

It displays
text/vnd.tiddlywiki
text
/vnd.tiddlywiki
Why there is two outputs for second $list while as per dominant append filter concept, if all tiddlers have type text/vnd.tiddlywiki, then second $list should have no output!

The documentation at https://tiddlywiki.com/#get%20Operator specifically says: 

Each input title is processed in turn. If the corresponding tiddler contains field F, and the value of this field is not empty, then its value is appended to the output.
Unlike most other Filter Operators, the selection output by get can contain duplicates. To avoid duplicates, use each[F]get[F].

Note that this documentation says "its value is appended"... but does *not* say "dominantly appended", and then it goes on to explain that this means the output "can contain duplicates". 

For the test case, "[tag[Examples]]", the filter produces 7 matching tiddlers.  However, only 3 of these tiddlers have a specified type of "text/vnd.tiddlywiki".  The rest have no specified type (i.e., the type field is blank).
Thus, the filter "[tag[Examples]get[type]]" results in 3 copies of "text/vnd.tiddlywiki"... and then adding "-[[text/vnd.tiddlywiki]]" to the filter removes 1 of them, leaving 2 remaining.

Even though this is unlike the behavior of other filters, it IS working as documented.

-e

Mohammad

unread,
Feb 10, 2020, 5:42:41 AM2/10/20
to TiddlyWiki
Thanks Eric!

It is really strange while I read tiddlywiki.com more often and check it before raise any questions, but I don't see these kind of hints :-) :-)
I need new eyeglasses. :-) 

By the way Tiddlywiki is one of those tools its side rules and grammar exceptions are MORE than its grammar rules.

Cheers
Mohammad
Reply all
Reply to author
Forward
0 new messages