.myFunction takie a parameter and create a list of titles. The parameter has to be tweaked, and this is what does the first line. The second line would use the tweaked value to do the real stuff and its results is a list of titles. I need to use :map to access tghe tweaked value and use it on the current input values with the help of all[current].
But since I use :map I have to do the enlist-input[]join[ ] in the end.
It could be simpler with a :as filter run call that would act as :map in the coding but return, for each input value, all the titles selected at te end of each run. The :as name is surely to be replaced by a more clever name but you get tghe idea.
Thanks to @pmario we have a much better organized filter run prefix docs since recently, with the nice railroad diagrams. But map seems to be missing the suffix in its diagram, I’ll fix it. I think it will be much better visible then.
This is in fact, only necessary, if you go ahead and use the function in a way that it only presents the first result, the join is used to stop this. If however you use the function in a filter, one that returns more than the first result, there is no need to join.
When I first started using the function I was annoyed at its behaviour returning the first only, but now I realise this is happening in multiple places within tiddlywiki, but I have no found multiple ways to defeat this first only behaviour.
The First only behavior also has its advantages and the text only output helps us avoid using the text widget.
Keep in mind we can also use functions as function operators. This has other behaviours.
I will try and give some nice examples and edit this reply;
I will also explore the use of the map: raw as part of the picture
Here is the simplest example I have that proves my assertion;
But we need a more comprehensive documentation of this
\function list.function() A B C
;Return first value only
# <<list.function>>
# {{{ [<list.function>] }}}
;Return list values
# {{{ [list.function[]] }}}
@TW_Tones Yes, I agree with you.The point is that I use $let and not the cumbersome $set. Se I only can get a unique value fos%r a varu%iable and thus I need the format trick.
It would be nice to have a kind of $set with all the ease of use of $let: multiple variables definitions, use of {{{ filter }}} to get the values for each variable. We could call it $mset for multi-set.
@TW_Tones This is exactly what I do. And enlist or enlist-input at the beginning of the next filter using the result of the previous one.
I find this distracting code. And any code is prone to typing errors, which do hard to find causes errors, so the less boiler plate I have, the best I feel.