is[current] AND all[current]

131 views
Skip to first unread message

Mohammad

unread,
Feb 3, 2019, 6:25:10 AM2/3/19
to tiddl...@googlegroups.com
Look at the below codes


  • Case i
  <$list filter="01 02 03">
  <$set name="xx" filter="[all[current]addprefix[Lec]]"  emptyValue="No output">
    <<xx>>
  </$set>  
  </$list>

Produces:   Lec01 Lec02 Lec03


  • Case ii
  <$list filter="01 02 03">
  <$set name="xx" filter="[is[current]addprefix[Lec]]" emptyValue="No output">
    <<xx>>
  </$set>  
  </$list>

Produces:   No output No output No output


What is the problem? Isn't it the all and is operator are the same?

--Mohammad

Mohammad

unread,
Feb 3, 2019, 6:56:58 AM2/3/19
to TiddlyWiki
For who received by email

The code revised !

--Mohammad 

S. S.

unread,
Feb 3, 2019, 7:41:37 AM2/3/19
to TiddlyWiki
Mohammad,

Aren't we lucky the is operator and the all operator aren't the same. Otherwise one would be redundant!

Reading the documentation of the is operator (including the last line):

input        a selection of titles

The all operator is similar, but its scope is the whole wiki.

To get the proper input into the is operator, I imagine it would need to be done with an explicit input, otherwise the way you wrote it, it would ONLY take the Current Tiddler the code was in as its input. To see that effect, put your code in a tiddler [[01]] and save it, and see the result!

I believe the proper way to do what you want is like this:

<$list filter="01 02 03">
<$set name="xx" filter="[<currentTiddler>is[current]addprefix[Lec]]" emptyValue="No output">
    <
<xx>>
</$set>  
</$list>

Regards

Mohammad

unread,
Feb 3, 2019, 9:23:17 AM2/3/19
to TiddlyWiki
Hello S.S,
 I think if we revise your proposed code as below

<$list filter="01 02 03">
<$set name="xx" filter="[<currentTiddler>addprefix[Lec]]" emptyValue="No output">
    <<xx>>
</$set>  
</$list>

It still works. No need for is[current].

But as you said is and all have different scope. I expect when the input is a list all should have a role.
What do you think?

--Mohammad

Mark S.

unread,
Feb 3, 2019, 10:13:36 AM2/3/19
to TiddlyWiki


On Sunday, February 3, 2019 at 4:41:37 AM UTC-8, S. S. wrote:
The all operator is similar, but its scope is the whole wiki.


Except the scope is the same when used with "all[current]"

I think there was another thread on is and all and a couple other techniques, and it was determined that "all[current]" was most efficient. But I might have remembered incorrectly.

I usually use "all" and get on with things.

The "is" operator has the advantage that it can take a "system" parameter, which is for some reason is missing from "all".

-- Mark

BurningTreeC

unread,
Feb 3, 2019, 10:56:49 AM2/3/19
to TiddlyWiki
Hi Mohammad,

the difference between the is and all operators, as you can see in the documentation:


... is, that the is operator takes a selection of titles as input
in your example it's without input, <currentTiddler>is[current] would work, [[01]is[current] would return Lec01 No output No output ...
the all operator creates an output, ignores every input. the is operator filters an input

S. S.

unread,
Feb 3, 2019, 12:02:27 PM2/3/19
to TiddlyWiki
Mohammad, the explanation by BurningTreeC is the really the key to understanding the issue here.


the all operator creates an output, ignores every input. the is operator filters an input

I guess the first : <$list filter="01 02 03"> :  is just setting the <<currentTiddler>> variable. The all operator can use that, the is operator ignores it?

I believe this difference between "creating an output" and "filtering an input" deserves to be clarified the documentation, and I may do that.


Also, Mark said:

The "is" operator has the advantage that it can take a "system" parameter, which is for some reason is missing from "all".

As a general question, would it not be a good idea to include a fundamental category of system in the all operator?

Mohammad

unread,
Feb 3, 2019, 2:06:27 PM2/3/19
to TiddlyWiki
S.S, Mark and BTC,
Many thanks for your kind reply. Still I am confused.

See also the below description by Tobias Beer. This is also nice example.



Actually I think when I have

<$list filter="01 02 03">
 here I have a local variable called currentTiddler and I can use it.



but, it seems is[current] IS only refer to the title of tiddler, and differs from the currentTiddler above (a loop variable)

I am trying to read and understand the documentation.

--Mohammad

Mark S.

unread,
Feb 3, 2019, 2:58:58 PM2/3/19
to TiddlyWiki

When you use the is operator, it needs a list of titles to precede it:


When you use the "all" operator, it generates its own title list just like "tag[Mohammad]" finds all the tiddlers tagged with "Mohammad".

Certain operators, like "title", "tag", and "all" are generators -- they generate a list of items from the entire wiki. To see this, try this at TiddlyWiki.com:

<$list filter="01 02 03">
  <$set name="xx" filter="[tag[HelloThere]all[current]addprefix[Lec]]"  emptyValue="No output">
    <<xx>>
  </$set> 
  </$list>

Even though  "tag[HelloThere]" generates a half dozen tiddlers, you only see the standard 3 outputs. This is because "all[current]" ignored it's input and generated it's own items based on the current tiddler. However, "tag" is extra, extra special in that it can generate tiddlers when at the start of a list, but work as a filter when in the middle. We use tag so often that it's easy to take this extra ability for granted.

-- Mark

Mohammad

unread,
Feb 3, 2019, 3:17:49 PM2/3/19
to TiddlyWiki
Hello Mark,
 Many thanks for your detailed explanation!

I got the point.

Cheers
Mohammad

Mohammad

unread,
Feb 3, 2019, 3:17:50 PM2/3/19
to TiddlyWiki

TonyM

unread,
Feb 3, 2019, 5:27:12 PM2/3/19
to TiddlyWiki
Mark,

This sounds like the behaviour I expected, and the English language would suggest this as well but why would all[current] supposed to be more efficent?

If we do just want to act in the current tiddler its fields and tags would the most efficent be
[<currentTiddler>····
No filtering single title?

Regards
Tony
Reply all
Reply to author
Forward
0 new messages