On Monday, 19 March 2018 10:41:20 UTC+1, PMario wrote:
>
> 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
> <https://tiddlywiki.com/#ListWidget>.
>
> It's main purpose is to iterate over a defined set of tiddlers.
> The set of tiddlers is defined using the filter
> <https://tiddlywiki.com/#Filters>-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>
>
>
>
You mean
<? for i in ["one", "two", "three"] ?>
${i}
<? end for ?>
> 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.
>
You mean
<? for i = ["one", "two","three"] ?>
<? for j = ["a","b","c"] ?>
${i}-${j}
<? end for ?>
<? end for ?>
Or
[ I ++ "-" ++ J || I<- ["one","two""three}, J <- ["a","b","c"]]
In a language which I am very familiar :-)
In my world this is not called "looping" it's called
a list-comprehension and is one of the corner stones of functional
programming
and is equivalent to a findall construct in Prolog (almost)
In yet another syntax this is
findall
${I} ++ "-" ++ ${J}
such that
I <- ["one", "two", "three"]
J <- ["a","b","cv"]
or something
I think a book (or a whatever) about TW has to explicitly build a bridge
between the TW syntax and the syntaxes with which the reader is familiar.
> have fun!
>
I am - this feels like learning smalltalk (scratch the surface and there is
a lot hidden underneath)
Cheers
/Joe
> 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 [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/24fb28fa-b2f7-4f21-b213-dce87e817b64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.