[tw5] Re: Intersection of two filter runs

2019-03-14 Thread Mohammad
Thanks Mark!

Added to TW-Script.

Cheers
Mohammad

On Thursday, March 14, 2019 at 6:26:37 PM UTC+3:30, Mark S. wrote:
>
> Here's a trimmer version of the previous macro. It seems to work and 
> doesn't require calling a macro on each list item:
>
> \define f1() [enlist]-[enlist]
> \define f2() [enlist]-[enlist]
> <$vars
>  x="1 2 3 4 5"
>  y= "2 7 9 3"
>  >
> <$list filter="[enlist] [enlist] -[subfilter] -[subfilter]" 
> variable=item>
> <>
> 
>  
>
> I think to find out which version is more efficient you'd have to load up 
> a huge array and time the difference. With only a handful of items, the 
> priority is which code is easiest to read and fix later on ?
>
> -- Mark
>
> On Wednesday, March 13, 2019 at 10:00:07 PM UTC-7, Mohammad wrote:
>>
>> Thanks Mark!
>>
>> Just one more question: What is your opinion on the intersection code 
>> above?
>>
>> In real world! In Tiddler Commander I have a filter search to filter some 
>> tiddlers based a certain criteria and then I have a checkbox widget to 
>> select among those tiddlers!
>> If I change the filter search (using textbox), I have still the selected 
>> tiddlers using checkbox there! So, I need extra step to determine if the
>> selected tiddlers by checkbox widget are existed in the new filter 
>> search. That the reason I have to find intersection.
>>
>> Thank you again Mark!
>>
>> --Mohammad
>>
>> On Thursday, March 14, 2019 at 8:09:52 AM UTC+3:30, Mark S. wrote:
>>>
>>> I don't think it qualifies as a true logical operator the way *run* and 
>>> *-run* do. I think of it more of as a funnel > operator, telling the 
>>> next run to use the previous run as input. I'm not sure that is the same as 
>>> a true intersection. That's why I did all the extra steps to form the 
>>> intersection. If the + was a true AND, I wouldn't have had to do that.
>>>
>>> -- Mark
>>>
>>> On Wednesday, March 13, 2019 at 9:28:38 PM UTC-7, Mohammad wrote:

 One point:
 The Tiddlywiki *+run* does not necessarily simulate the logical AND 
 operator!

 --Mohammad

 On Wednesday, March 13, 2019 at 8:17:09 PM UTC+3:30, Mohammad wrote:
>
> I have a code like below
>
> <$vars
>  x="1 2 3 4 5"
>  y= "2 7 9"
>  >
> <$list filter="[enlist] +[enlist]" variable=item>
> <>
> 
>  
>
> Produces
> 2 7 9
>
> I expect +run to logically AND the filter output, means those item are 
> in both filter run or the INTERSECTION of two run
> e.g. *2*
>
> How can I implement this?
>
> --Mohammad
>
> More information
> - https://ooktech.com/jed/ExampleWikis/FilterLogicExamples/
> - http://tobibeer.github.io/tw/filters/#Filter%20Examples
>


-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/7ceb1be4-1179-4b08-a273-98f1d19ec0c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Intersection of two filter runs

2019-03-14 Thread 'Mark S.' via TiddlyWiki
Here's a trimmer version of the previous macro. It seems to work and 
doesn't require calling a macro on each list item:

\define f1() [enlist]-[enlist]
\define f2() [enlist]-[enlist]
<$vars
 x="1 2 3 4 5"
 y= "2 7 9 3"
 >
<$list filter="[enlist] [enlist] -[subfilter] -[subfilter]" 
variable=item>
<>

 

I think to find out which version is more efficient you'd have to load up a 
huge array and time the difference. With only a handful of items, the 
priority is which code is easiest to read and fix later on ?

-- Mark

On Wednesday, March 13, 2019 at 10:00:07 PM UTC-7, Mohammad wrote:
>
> Thanks Mark!
>
> Just one more question: What is your opinion on the intersection code 
> above?
>
> In real world! In Tiddler Commander I have a filter search to filter some 
> tiddlers based a certain criteria and then I have a checkbox widget to 
> select among those tiddlers!
> If I change the filter search (using textbox), I have still the selected 
> tiddlers using checkbox there! So, I need extra step to determine if the
> selected tiddlers by checkbox widget are existed in the new filter search. 
> That the reason I have to find intersection.
>
> Thank you again Mark!
>
> --Mohammad
>
> On Thursday, March 14, 2019 at 8:09:52 AM UTC+3:30, Mark S. wrote:
>>
>> I don't think it qualifies as a true logical operator the way *run* and 
>> *-run* do. I think of it more of as a funnel > operator, telling the 
>> next run to use the previous run as input. I'm not sure that is the same as 
>> a true intersection. That's why I did all the extra steps to form the 
>> intersection. If the + was a true AND, I wouldn't have had to do that.
>>
>> -- Mark
>>
>> On Wednesday, March 13, 2019 at 9:28:38 PM UTC-7, Mohammad wrote:
>>>
>>> One point:
>>> The Tiddlywiki *+run* does not necessarily simulate the logical AND 
>>> operator!
>>>
>>> --Mohammad
>>>
>>> On Wednesday, March 13, 2019 at 8:17:09 PM UTC+3:30, Mohammad wrote:

 I have a code like below

 <$vars
  x="1 2 3 4 5"
  y= "2 7 9"
  >
 <$list filter="[enlist] +[enlist]" variable=item>
 <>
 
  

 Produces
 2 7 9

 I expect +run to logically AND the filter output, means those item are 
 in both filter run or the INTERSECTION of two run
 e.g. *2*

 How can I implement this?

 --Mohammad

 More information
 - https://ooktech.com/jed/ExampleWikis/FilterLogicExamples/
 - http://tobibeer.github.io/tw/filters/#Filter%20Examples

>>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/551c12a5-f028-44fa-b92c-9090db32a7bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Intersection of two filter runs

2019-03-13 Thread Mohammad
Thanks Mark!

Just one more question: What is your opinion on the intersection code above?

In real world! In Tiddler Commander I have a filter search to filter some 
tiddlers based a certain criteria and then I have a checkbox widget to 
select among those tiddlers!
If I change the filter search (using textbox), I have still the selected 
tiddlers using checkbox there! So, I need extra step to determine if the
selected tiddlers by checkbox widget are existed in the new filter search. 
That the reason I have to find intersection.

Thank you again Mark!

--Mohammad

On Thursday, March 14, 2019 at 8:09:52 AM UTC+3:30, Mark S. wrote:
>
> I don't think it qualifies as a true logical operator the way *run* and 
> *-run* do. I think of it more of as a funnel > operator, telling the next 
> run to use the previous run as input. I'm not sure that is the same as a 
> true intersection. That's why I did all the extra steps to form the 
> intersection. If the + was a true AND, I wouldn't have had to do that.
>
> -- Mark
>
> On Wednesday, March 13, 2019 at 9:28:38 PM UTC-7, Mohammad wrote:
>>
>> One point:
>> The Tiddlywiki *+run* does not necessarily simulate the logical AND 
>> operator!
>>
>> --Mohammad
>>
>> On Wednesday, March 13, 2019 at 8:17:09 PM UTC+3:30, Mohammad wrote:
>>>
>>> I have a code like below
>>>
>>> <$vars
>>>  x="1 2 3 4 5"
>>>  y= "2 7 9"
>>>  >
>>> <$list filter="[enlist] +[enlist]" variable=item>
>>> <>
>>> 
>>>  
>>>
>>> Produces
>>> 2 7 9
>>>
>>> I expect +run to logically AND the filter output, means those item are 
>>> in both filter run or the INTERSECTION of two run
>>> e.g. *2*
>>>
>>> How can I implement this?
>>>
>>> --Mohammad
>>>
>>> More information
>>> - https://ooktech.com/jed/ExampleWikis/FilterLogicExamples/
>>> - http://tobibeer.github.io/tw/filters/#Filter%20Examples
>>>
>>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/bba14014-dbd8-4d16-b53f-2c88f7a39062%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Intersection of two filter runs

2019-03-13 Thread 'Mark S.' via TiddlyWiki
I don't think it qualifies as a true logical operator the way *run* and 
*-run* do. I think of it more of as a funnel > operator, telling the next 
run to use the previous run as input. I'm not sure that is the same as a 
true intersection. That's why I did all the extra steps to form the 
intersection. If the + was a true AND, I wouldn't have had to do that.

-- Mark

On Wednesday, March 13, 2019 at 9:28:38 PM UTC-7, Mohammad wrote:
>
> One point:
> The Tiddlywiki *+run* does not necessarily simulate the logical AND 
> operator!
>
> --Mohammad
>
> On Wednesday, March 13, 2019 at 8:17:09 PM UTC+3:30, Mohammad wrote:
>>
>> I have a code like below
>>
>> <$vars
>>  x="1 2 3 4 5"
>>  y= "2 7 9"
>>  >
>> <$list filter="[enlist] +[enlist]" variable=item>
>> <>
>> 
>>  
>>
>> Produces
>> 2 7 9
>>
>> I expect +run to logically AND the filter output, means those item are in 
>> both filter run or the INTERSECTION of two run
>> e.g. *2*
>>
>> How can I implement this?
>>
>> --Mohammad
>>
>> More information
>> - https://ooktech.com/jed/ExampleWikis/FilterLogicExamples/
>> - http://tobibeer.github.io/tw/filters/#Filter%20Examples
>>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/521ce9e0-01f2-41ad-ac76-1285e664d6e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Intersection of two filter runs

2019-03-13 Thread Mohammad
Further input

<$vars
 x="7 8 -1 -3 9 11"
 y= "1 2 3 4 5 6 7 8 9"
 >
<$list filter="[enlist] [enlist] +[sortan[]]">
<>


The OR logical operator correctly works!
https://tiddlywiki.com/#Filter%20Expression


So, is there a bug in +run filter expression!

--Mohammad



On Wednesday, March 13, 2019 at 8:17:09 PM UTC+3:30, Mohammad wrote:
>
> I have a code like below
>
> <$vars
>  x="1 2 3 4 5"
>  y= "2 7 9"
>  >
> <$list filter="[enlist] +[enlist]" variable=item>
> <>
> 
>  
>
> Produces
> 2 7 9
>
> I expect +run to logically AND the filter output, means those item are in 
> both filter run or the INTERSECTION of two run
> e.g. *2*
>
> How can I implement this?
>
> --Mohammad
>
> More information
> - https://ooktech.com/jed/ExampleWikis/FilterLogicExamples/
> - http://tobibeer.github.io/tw/filters/#Filter%20Examples
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/2aa02602-5765-4659-a0a1-3620e3bebdb9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Intersection of two filter runs

2019-03-13 Thread Mohammad
One point:
The Tiddlywiki *+run* does not necessarily simulate the logical AND 
operator!

--Mohammad

On Wednesday, March 13, 2019 at 8:17:09 PM UTC+3:30, Mohammad wrote:
>
> I have a code like below
>
> <$vars
>  x="1 2 3 4 5"
>  y= "2 7 9"
>  >
> <$list filter="[enlist] +[enlist]" variable=item>
> <>
> 
>  
>
> Produces
> 2 7 9
>
> I expect +run to logically AND the filter output, means those item are in 
> both filter run or the INTERSECTION of two run
> e.g. *2*
>
> How can I implement this?
>
> --Mohammad
>
> More information
> - https://ooktech.com/jed/ExampleWikis/FilterLogicExamples/
> - http://tobibeer.github.io/tw/filters/#Filter%20Examples
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/621f9f5c-6913-4083-a879-eacb5ceee426%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Intersection of two filter runs

2019-03-13 Thread Mohammad
Hi again,
 I tried to do something like this

\define intersect-item(filter, item)
<$list filter="[<__item__>] -[subfilter<__filter__>]" variable="result" 
emptyMessage=<<__item__>> >

\end

\define intersect(flt1, flt2)
<$list filter=<<__flt2__>> variable=item >
<$macrocall $name="intersect-item" filter=<<__flt1__>> item=<> />

\end


<$vars
 x="7 8 -1 -3 9 11"
 y= "1 2 3 4 5 6 7 8 9"
 >
<$macrocall $name=intersect 
   flt1="[enlist]"
   flt2="[enlist]"
/>


The procedure is, I check every item in filter2 output to see if it is in 
filter1 output.
If so, I display it, if not, I ignore it!

I am not sure if the code is optimize and according to TW rules and 
standard.

Application: I have two set of tiddlers, for example those have property1 
and those have property2. I want to show 
tiddlers have both properties!



Give me your comments.

--Mohammad


On Wednesday, March 13, 2019 at 10:44:24 PM UTC+3:30, Mark S. wrote:
>
>
> You may not like this version, but it seems to work:
>
> <$vars
>  x="1 2 3 4 5"
>  y= "2 7 9 3"
> f1="[enlist]-[enlist]"
> f2="[enlist]-[enlist]"
>  >
> <$list filter="[enlist] [enlist] -[subfilter] -[subfilter]" 
> variable=item>
> <>
> 
>  
>
> I worked the logic out with a venn diagram.
>
> I was pleasantly surprised that the <> brackets were interpolated two 
> levels down.
>
> Thanks!
> -- Mark
> On Wednesday, March 13, 2019 at 9:47:09 AM UTC-7, Mohammad wrote:
>>
>> I have a code like below
>>
>> <$vars
>>  x="1 2 3 4 5"
>>  y= "2 7 9"
>>  >
>> <$list filter="[enlist] +[enlist]" variable=item>
>> <>
>> 
>>  
>>
>> Produces
>> 2 7 9
>>
>> I expect +run to logically AND the filter output, means those item are in 
>> both filter run or the INTERSECTION of two run
>> e.g. *2*
>>
>> How can I implement this?
>>
>> --Mohammad
>>
>> More information
>> - https://ooktech.com/jed/ExampleWikis/FilterLogicExamples/
>> - http://tobibeer.github.io/tw/filters/#Filter%20Examples
>>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/f88194e2-b7bf-498f-ae0a-eba31392488c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Intersection of two filter runs

2019-03-13 Thread Mohammad
Many thanks Mark,
 Yes, it works! I am wondering how can I develop a macro to find the 
intersection of any two filter runs!
Seems difficult.

--Mohammad

On Wednesday, March 13, 2019 at 10:44:24 PM UTC+3:30, Mark S. wrote:
>
>
> You may not like this version, but it seems to work:
>
> <$vars
>  x="1 2 3 4 5"
>  y= "2 7 9 3"
> f1="[enlist]-[enlist]"
> f2="[enlist]-[enlist]"
>  >
> <$list filter="[enlist] [enlist] -[subfilter] -[subfilter]" 
> variable=item>
> <>
> 
>  
>
> I worked the logic out with a venn diagram.
>
> I was pleasantly surprised that the <> brackets were interpolated two 
> levels down.
>
> Thanks!
> -- Mark
> On Wednesday, March 13, 2019 at 9:47:09 AM UTC-7, Mohammad wrote:
>>
>> I have a code like below
>>
>> <$vars
>>  x="1 2 3 4 5"
>>  y= "2 7 9"
>>  >
>> <$list filter="[enlist] +[enlist]" variable=item>
>> <>
>> 
>>  
>>
>> Produces
>> 2 7 9
>>
>> I expect +run to logically AND the filter output, means those item are in 
>> both filter run or the INTERSECTION of two run
>> e.g. *2*
>>
>> How can I implement this?
>>
>> --Mohammad
>>
>> More information
>> - https://ooktech.com/jed/ExampleWikis/FilterLogicExamples/
>> - http://tobibeer.github.io/tw/filters/#Filter%20Examples
>>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/5287aa26-2cc6-4216-bb80-04d81b92feb9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Intersection of two filter runs

2019-03-13 Thread 'Mark S.' via TiddlyWiki

You may not like this version, but it seems to work:

<$vars
 x="1 2 3 4 5"
 y= "2 7 9 3"
f1="[enlist]-[enlist]"
f2="[enlist]-[enlist]"
 >
<$list filter="[enlist] [enlist] -[subfilter] -[subfilter]" 
variable=item>
<>

 

I worked the logic out with a venn diagram.

I was pleasantly surprised that the <> brackets were interpolated two 
levels down.

Thanks!
-- Mark
On Wednesday, March 13, 2019 at 9:47:09 AM UTC-7, Mohammad wrote:
>
> I have a code like below
>
> <$vars
>  x="1 2 3 4 5"
>  y= "2 7 9"
>  >
> <$list filter="[enlist] +[enlist]" variable=item>
> <>
> 
>  
>
> Produces
> 2 7 9
>
> I expect +run to logically AND the filter output, means those item are in 
> both filter run or the INTERSECTION of two run
> e.g. *2*
>
> How can I implement this?
>
> --Mohammad
>
> More information
> - https://ooktech.com/jed/ExampleWikis/FilterLogicExamples/
> - http://tobibeer.github.io/tw/filters/#Filter%20Examples
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
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/8901e0b7-fe96-4925-bd7f-651125af18e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.