Jed is highlighting something I posted about for you elsewhere. Tiddlywiki is not a procedural language, it works to link and update every relationship on every change. This is its strength and the reason people including myself, with expirence of proceedural language algorithims, initaly struggle with the concepts.
It is however all worthwhile, I liken it to taking the red pill not the blue one (the matrix movie reference).
Not withstanding the above points i believe the richest source of what you are asking for can be found in Evans formula plugin.
Tiddlywiki is a quine, a platform, a user interface, a database, a document, a website and more all in one.
TiddlyWiki demands we suspend some preconceptions so you can learn it enought, that you then apply prior knowledge to it.
Yours sincerely
Tony
Give you a personal orientation. Look for my previouse post to you.
Tony
So, what is the equivalent tiddler code to perform the followingoperations in a conventional programming languages?1) Set a variable to a simple value and use the value
<$set name="local-scope" value="known in $set boundary only">
<<local-scope>>
</$set>
2) Set a variable to a complex value and use the complex value
\define tiddler-scope() known within a tiddler
<$set name="local-scope" value="known in $set boundary only">
<<tiddler-scope>>
<<local-scope>>
</$set>
---
<<tiddler-scope>>
<<local-scope>> ... is silently ignored.
3) Perform an if-then-else or switch operation
4) Execute a loop
<$list filter="one two three">
<<currentTiddler>>,
</$list>
<$list filter="one two three" variable="loop-var">
<<loop-var>>,
</$list>
<$list filter="one two three" variable="outer">
<$list filter="a b c" variable="inner">
<<outer>>-<<inner>>
</$list>
</$list>
5) Define a local (to the tiddler) subroutine and call it
6) Define a global subroutine and call it
It seems to me that a simple table with two columnsshowing in the left hand a common a common programmingconstruct and the right hand side the equivalent Tiddler code wouldmade TW a lot easier to lean.
A b b c
You would get A b c
Or
A b c A
You would get A b c
Because as I conceptualise it the "titles" are deduplicated, because titles are unique.
Why because if we had a filter that included
taga or tagb
We would not want the same tiddler title listed twice because its tagged both taga and tagb
Regards
Tony
If a variable is set to another variable such as <<currentTiddler>> the value is not frozen as the value at the time you set it, but will return the name of the current tiddler in the context it is used.
You can apparently use wikify to freeze the variable.
Others can say this better.
Tony
Wikitext isn't a Turing completely language, there aren't necessarily equivalents to what you are talking about. TiddlyWiki has very few attributes of a normal programming language, I don't think that tiddlywiki has the equivalent of a procedure from an imperative programming language. You can use javascript in tiddlywiki, but in that case it is javascript, not anything specific to tiddlywiki.
TiddlyWiki does allow a lot of flexibility using recursion and, in my opinion at least, is something like declarative or functional programming.That said, you can do if-then-else using lists like this:<$list filter='condition statement' emptyMessage=<<Else result>>>Than result</$list>as long as you can define your condition as a filter that returns one or more results if true and no results if false. If you are comfortable with set theory than the filtering operations in tiddlywiki are very powerful.
On Sunday, March 18, 2018 at 11:01:58 PM UTC+1, Joe Armstrong wrote:4) Execute a loop
In TW everything, that needs looping is done with the <$list widget.
It's main purpose is to iterate over a defined set of tiddlers.
The set of tiddlers is defined using the filter-attribute. eg:
<$list filter="one two three">
<<currentTiddler>>,
</$list>
The "loop-variable" can be defined:
<$list filter="one two three" variable="loop-var">
<<loop-var>>,
</$list>
The list widget can be nested:
<$list filter="one two three" variable="outer">
<$list filter="a b c" variable="inner">
<<outer>>-<<inner>>
</$list>
</$list>
Lists can be super complex. ... So these examples, only scratch the surface of the possibilities.
have fun!
mario
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@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/4030277d-2605-4b12-9348-3199c7c6d9d0%40googlegroups.com.
Now there are 10 quadzilion template languages that can do this.For example in django I might write{% if has_tag("foo") %}<h1>hello I'm a foo</h1>...{% else %}<h1>hello<>h1>{% endif %}
<ul>
<$list filter="[tag[foo]]" variable="you-name-it" emptyMessage="no tiddler tagged foo">
<li>hello I'm a foo - <<you-name-it>></li>
</$list><$list filter="[!tag[foo]]">
<li>hello I'm NOT tagged foo - <<currentTiddler>></li>
</$list>
<ul>
The TW equivalent has no variable i but seems to have an implicit variable
<<currentTiddler>> which is somewhat confusing.