Two filter runs sequentially means {result of filter run 1} followed by
{result of filter run 2} (dominantly appended I believe) which isn't
exactly the same as OR. The other thing is that [[]] isn't a false/invalid
value, as far as filters are concerned. So, the list generated is "[[]]
[[B]]" which are both valid inputs to the following filter run. And so
[limit[1]] takes the first value passed to it, which is [[]].
Matt
On Friday, April 5, 2019 at 9:22:19 AM UTC-4, Mohammad wrote:
>
> Mat,
> I expect the macro test1 returns B for test 3, becuase while a param is
> empty but b has value and [[$a$]] [[$b$]] means OR
> Am I right?
>
> --Mohammad
>
> On Friday, April 5, 2019 at 5:48:35 PM UTC+4:30, Matthew Lauber wrote:
>>
>> The difference is due to the enlist filter. In the first test case, [[]]
>> is parsed as a tiddler title with the empty string "" as it's value.
>> Weird, but it's still added to the input title list of the filter. But in
>> the enlist filter, it does string parsing to determine all the titles in
>> the parameter, and it determines there aren't any in the param, so it
>> doesn't add anything to the list of input tiddlers titles.
>>
>> On Friday, April 5, 2019 at 8:46:40 AM UTC-4, Mohammad wrote:
>>>
>>> Hi S.S.,
>>> Thank you for sharing!
>>> I don't understand the result of test 3 in two cases! Why they are
>>> different?
>>>
>>> --Mohammad
>>>
>>>
>>>
>>> On Friday, April 5, 2019 at 3:48:16 PM UTC+4:30, S. S. wrote:
>>>>
>>>>
>>>> When trying to test for an *either/or* parameter, I used a filter, and
>>>> found this interesting behaviour:
>>>>
>>>> \define test1(a b)
>>>> <$list filter="[[$a$]] [[$b$]] +[limit[1]]" emptyMessage="c"></$list>
>>>> \end
>>>> \define test2(a b)
>>>> <$list filter="[enlist[$a$]] [enlist[$b$]] +[limit[1]]" emptyMessage=
>>>> "c"></$list>
>>>> \end
>>>>
>>>> !! Test 1
>>>> 1. <<test1 a:A b:B>> <br>
>>>> 2. <<test1 a:A b:"">> <br>
>>>> 3. <<test1 a:"" b:B>> <br>
>>>> 4. <<test1 a:"" b:"">> <br>
>>>>
>>>> !!Test 2
>>>> 1. <<test2 a:A b:B>> <br>
>>>> 2. <<test2 a:A b:"">> <br>
>>>> 3. <<test2 a:"" b:B>> <br>
>>>> 4. <<test2 a:"" b:"">> <br>
>>>>
>>>>
>>>> Test 1
>>>>
>>>> 1. A
>>>> 2. A
>>>> 3.
>>>> 4.
>>>>
>>>> Test 2
>>>>
>>>> 1. A
>>>> 2. A
>>>> 3. B
>>>> 4. c
>>>>
>>>> Perhaps useful too keep in mind!
>>>>
>>>> Cheers
>>>>
>>>>
>>>>
>>>>
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/38039f03-c243-447b-bc93-03d24d23bf9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.