On Monday, October 26, 2020 at 3:10:59 PM UTC-7, Jean-Pierre Rivière wrote:
>
> What's the use of subfilter in real life? It seems such a strange beast.
> I'm really confused. I wish there be an equivalent of map() found in
> functional language. I thought subfilter was just that but visibly it is
> not.
>
The subfilter operator allows you to use a variable to specify some piece
of filter syntax. Thus, if you wanted to have different filters based on a
field value, you could write:
<$set name="F" filter="[{!!setting}match[somevalue]]" value="[somefilter]"
emptyValue="[someotherfilter]">
<$list filter="[subfilter<F>]"/>
</$set>
Note in the above example, I've used the "conditional variable assignment"
form of $set (see https://tiddlywiki.com/#SetWidget)
in the complete filter below, what is the input and what is the parameter S?
> [subfilter[one two three]addsuffix[!]]
> input should be: every tiddlers (but system tiddlers).
> S is <<one two three>> and so S is a collection of three tiddler titles.
> Although it does not seems so because
>
[[one two three]addsuffix[!]]
>
does not produce the same result ("one two three!" instead of "one! two!
> three!").
>
The first syntax (using subfilter[one two three]) specifies three tiddler
titles.
The second syntax (using [one two three] specifies a single text string.
To get the same results as subfilter[one two three] you could use
enlist[...], like this:
[enlist[one two three]addsuffix[!]]
Le lundi 26 octobre 2020 à 19:00:52 UTC+1, Mark S. a écrit :
>
>> Unfortunately, using a subfilter won't allow you to process the tiddlers
>> the way you want. You will need a nested loop, with the outer list finding
>> the tiddlers and the inner list extracting the first word.
>>
>
What Mark has suggested -- using nested lists -- is this:
<$list filter="[tag[Chrome]]">
<$list filter="[<currentTiddler>splitregexp[\W]!is[blank]first[]]"/>
</$list>
-e
--
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/c0ea12f4-3bf1-41a7-a271-1e04c55718aco%40googlegroups.com.