The Islander

I agree this should be better documented. To stimulate the discussion;

As the person who submitted that issue on github subfilter and subsequently 
closed it, the filter operator, and the subsequent :filter run prefix have 
changed this quite a bit. My concern then was "not having a filter to be 
sub of when used:, however as the first example show I have effectively 
gotten what I asked for 

The subfilter was first on the scene, and made imbedding a full filter 
inside another much easier, otherwise you would have to reconstruct the 
filter from filter fragments. 

>From the doco note it still uses the word subfilter but they look the same.
*Filter operator*
*Apply a subfilter to each input title and return the titles that return a 
non-empty result from the subfilter*  
*The filter operator runs a subfilter for each input title, and returns 
those input titles for which the subfilter returns a non-empty result (in 
other words the result is not an empty list). The results of the subfilter 
are thrown away.  *

*subfilter operator*
 select titles from the operand interpreted as a filter expression 
<https://tiddlywiki.com/prerelease/#Filter%20Expression>
* Compare with the similar filter 
<https://tiddlywiki.com/prerelease/#filter%20Operator> operator which runs 
a subfilter against each title, returning those titles that return a 
non-empty list (and discards the results of the subfilter)*  

In the following example there is no apparent difference, remember there is 
an implied [all[].. at the beginning of reach run.

\define active-filter() [!tag[done]!tag[reference]]
{{{ [tag[todo]count[]] }}}

{{{ [tag[todo]subfilter<active-filter>count[]] }}}

{{{ [tag[todo]!subfilter<active-filter>count[]] }}}
<hr>
{{{ [tag[todo]filter<active-filter>count[]] }}}

{{{ [tag[todo]!filter<active-filter>count[]] }}}

Regards
Tones
On Sunday, 1 August 2021 at 14:19:00 UTC+10 The Islander wrote:

> Hello, after reading the official documentation on subfilter and filter, 
> it's not clear to me what the difference is between these two operators.
>
>    - Why would someone choose to use one over the other? A couple of 
>    simple examples where one differentiates from the other would be very 
>    useful.
>    - Is subfilter suitable for use in the middle of a filter expression? 
>    The subfilter documentation page itself shows an example of a subfilter in 
>    the middle of a filter expression, but none of the examples do this
>    - I'm further confused by the discussion in this issue on Github 
>    <https://github.com/Jermolene/TiddlyWiki5/issues/3644> which is 
>    requesting filter as a simple alias of subfilter for readability
>
> On a side note, I thought there would be some consistency to availability 
> of currentTiddler within the operand of filter, but there isn't 
> <https://github.com/Jermolene/TiddlyWiki5/pull/5691>. Are saqimtiaz's 
> improvements something slated to be included in 5.2.0?
>
> Thanks!
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b48a9aee-41f5-4dc0-bbcc-88183bc189c3n%40googlegroups.com.

Reply via email to